June 13, 2016
Well Guys, It is very simple to do CRUD operation in MVC using Scaffolded item.
Step1 : Create an empty ASP.NET Web Application in Visual Studio as shown below:
Step 2: Then add an empty model as shown below:Step 3: Then,add the Model and entity as shown below:Step 4: Add the properties that you want in the model by right clicking on the properties field as shown below:Step 5: After completion of adding the required properties you must generate the database from model as shown below:Step 6: A dialog box will appear where you have to choose the database name, You can use the already made database or you can create from there as well. I am making the new database “CollegeStudent”.Step 7: Other box will appears do as shown below. That automatically setups the necessary Connection strings for the connection with the database.Step 8: Dialog box will automatically close and will be redirected to the visual studio to execute the connections for .edmx as below:Step 9: Now add the controller inside the controller folder as shown below:Step 9: Choose MVC 5 Controller with views, using Entity Frame Work as below:Step 10: Choose the Model name that you made when making the entity, also choose the context name that you made earlier and enter the content name that you want. In my case, I have as shown below:Step 11: Go to RouteConfig inside App_Start and change the controller name to the one that you made earlier and enter the action method name that you want to call when the page loads. In my case, I have shown as below:Step 12: Finally, run it in the browser. then you will get the view as shown below now you can create, add, delete menu there and go through it for proper operation as you need.Thank you for you time! Keep visiting my website for more other blogs.