For beginners, CRUD Applications are the applications that uses 4 operations for manipulating data. Those 4 operations are Inserting data, Retrieving data, Editing data and Deleting data. You can also find these commands in Databases such as Select, Insert, Delete and Update.
To follow the drill, First Create a New MVC 4 internet Project, "CrudMvcApp". Now goto Models Folder in Solution Explorer, Right Click , goto add Class and name it "Restaurant.cs" and add the following Code.
Create another class file in Model with the name RestaurantContext.cs, yes this is the same file that we have created in our previous exercises, place the following code in it. You need to add namespace for DbContext "using System.Data.Entity;" above your class file. This is the same code that I have used in my previous blog related Code First and Data Annotation.
In order to avoid complexity i am using only one model for time being and without relation simple implimentation of Code First
Goto Controllers Folder in Solution Explorer, Right Click on the folder goto Add > Controller and name the Controller "RestaurantController.cs". From Scoffolding Option Select Template as "MVC Controller with empty read/write actions".
To follow the drill, First Create a New MVC 4 internet Project, "CrudMvcApp". Now goto Models Folder in Solution Explorer, Right Click , goto add Class and name it "Restaurant.cs" and add the following Code.
Create another class file in Model with the name RestaurantContext.cs, yes this is the same file that we have created in our previous exercises, place the following code in it. You need to add namespace for DbContext "using System.Data.Entity;" above your class file. This is the same code that I have used in my previous blog related Code First and Data Annotation.
In order to avoid complexity i am using only one model for time being and without relation simple implimentation of Code First
Goto Controllers Folder in Solution Explorer, Right Click on the folder goto Add > Controller and name the Controller "RestaurantController.cs". From Scoffolding Option Select Template as "MVC Controller with empty read/write actions".