Entity framework 6 Stored Procedure CRUD in asp.net MVC 5 - Tutorial

For Consultation : +91 9887575540

Stay Connected :

Hi, today I am writing a blog related to the entity framework (EF) and asp.net mvc 5. Stored procedures (SP) makes life easy of coder. Writing complex queries in SQL server is easier rather than LINQ queries. changes in SQL queries have minor effects in C# code which can be understood and solve very easily.So guys lets start step by step. Please follow following steps.

Create a new database table “Login” in sql server.Database Table

Run following sql queries in your database(here my database name is ‘example’)

Step1. Create New Project

CReate New Project

2_CReate Empty Project


Step2: Install Entity Framework using package manager console or nuget manager. here I am using package manager console.









Step3: Now we are going to create ado.net entity model. Right click on models folder and select ADO.net entity data model.

5_Add_Ado.NET Entity_Model 6_Add_ModelName 7_Add_Database_Designer 8_Add_New_SQL_Connection 9_Add_SQL_ServerName_And_Database_Name 10_Example_Entities

Step 4: Now select Table and all stored procedures.11_Select_Stored_Procedure_ANd_Table_Entity_Framework 12_Model_Browser

Step 5: Check all stored procedures are in function import directory. EF execute SP only by functions.


Step 6: Create new controller “Home”

14_Add_New_Controller 15_Add_Controller_Scaffolding

ASP.NET Core 2.0 Online Training

ASP.NET Core 2.0 Online Training

16_Add_Name_To_Controller 17_Add_Index_View

Step 7: Create View for Index action using scaffolding.

18_Add_List_Index_View 19_Build_Project

Step 7: You can update functions by right click them and by selecting edit option.

20_change_entity 21_details 22_update_model

Step 8: we created Index.cshtml view using scaffolding now you can create views for Create, Delete and Insert.I am not telling you how we can do this , I already mention it in last blogs.

So write following code into your Home Controller and run it.

Select your currency