- Http://sadin.dev
- https://sadin.dev
- in/EnKamran
- c/MrSadin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Select query | |
//Table name : MyTable | |
//In this table i have one field called : PropertyName | |
using(var db = new MyDbContext()) | |
{ | |
var myData = db.MyTableName.SqlQuery("SELECT * From MyTableName").ToList(); | |
foreach(var data in myData) | |
{ | |
Response.Write(data.PropertyName + "<br/>"); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all you should install pre requirements: | |
Install Dot Net Core (http://dot.net/Core) | |
Install Visual Studio Code | |
1. Now run Visual Studio Code | |
2. Press Ctrl + ` (or from View menu select Integrated Terminal) | |
3. Navigate to folder that you want to create project in it. | |
4. run this command : dotnet new web (this will create project files in current folder) | |
5. Open Startup.cs file and edit it : | |
5.1 Add 'services.AddMvc();' to ConfigureServices void | |
5.2 Add route to Configure void : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
// Add framework services. | |
services.AddDbContext<ApplicationDbContext>(options => | |
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); | |
services.AddIdentity<ApplicationUser, IdentityRole>() | |
.AddEntityFrameworkStores<ApplicationDbContext>() | |
.AddDefaultTokenProviders(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For publish .net core project open terminal (command) and navigate to project directory | |
Then type dotnet publish -o /PublishFolderPath |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First of all install vscode-nuget-package-manager Extension. | |
Open .cspro file | |
Press Ctrl + Shift + P and type >NuGet Package MAnager: Add Package | |
Type Microsoft.EntityFrameworkCore.SqlServer | |
use dotnet restore | |
Create database 'MyDatabase' and a table called MyModels with 3 fields (Id, FullName,Email) | |
Add 'Models' folder and 'MyDbContext.cs' and 'MyModel.cs' files in it | |
Open MyModel.cs and add this codes : | |
using Microsoft.EntityFrameworkCore; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Create directory : | |
mkdir DirectoryName | |
mkdir MrSadin | |
2. Navigate to directory : | |
cd DirectoryName (Or Path) | |
cd MrSadin | |
3. Delete Empty Directory : (Attention, directory should be empty) | |
rmdir DirectoryName | |
rmdir MrSadin | |
4. Delete directory that contains some files |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So its time to working with Views | |
At first create Views folder : mkdir Views | |
Create Home and Shared folder : mkdir Views\Home mkdir Views\Shared | |
Creating files : | |
echo.>Views\_ViewImports.cshtml | |
echo.>Views\_ViewStart.cshtml | |
echo.>Views\Shared\_Layout.cshtml | |
echo.>Views\Home\Index.cshtml | |
Open Startup.cs and add this line to Configure method : | |
app.UseStaticFiles(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0. ASP.NET Core Tutorial for Beginners: | |
http://www.webdevelopmenthelp.net/2017/02/asp-net-core-tutorial-beginners.html | |
0.1 : ASP.Net Core 1.1 - Getting Started Tutorial : | |
http://www.dotnetcurry.com/aspnet/1329/aspnet-core-11-what-is-new | |
1. Drag and Drop file upload in ASP.NET Core : | |
http://www.dotnetawesome.com/2017/02/drag-drop-file-upload-aspnet-mvc.html | |
2. Writing a Blog Engine in ASP.NET Core : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0. Create new console app (dotnet new console) | |
1. Create appsettings.js | |
2. Add this codes to file : | |
{ | |
"ConnectionStrings": | |
{ | |
"SampleConnection": "server=localhost;userid=root;pwd=;port=3305;database=KamranDb3;" | |
} | |
} | |
3. Add this packages using Nuget Package Manager (or just copy this to YourProject.csproj file) : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(Another way : https://github.com/tanveery/recaptcha-net) | |
1. Get secret key and site key from : https://www.google.com/recaptcha/admin | |
2. Add them to web config : | |
<add key="recaptcha-secret-key" value="...[secret key]" /> | |
<add key="recaptcha-public-key" value="...[public-key]" /> | |
3. Install Package : | |
PM > Install-Package ReCaptcha-AspNet |
OlderNewer