Hello Geeks ! Here I will show you how to develop a simple application to perform CRUD operations that is ADD, UPDATE, DELETE in ASP.NET without writing any code.
Some of you do not want to get hands dirty on coding and want to develop a simple application to Add, Update and Delete any records or data or any kind of information.
We will use ASP.NET MVC with entity framework to develop the application performing CRUD Operations. We are going to use Sql Server to store the Database and ADO.NET data access technology to access data from Sql Server database. Here I am using Visual Studio 2015.
Let us start Building
Step 1 Open Visual Studio click on New Project. Now under Templates -> Visual C# -> Windows -> click on and select ASP.NET Web Application. Give your Project a Name like here I have given.
Step 2 Select MVC from the next window or you can also select Empty template and click on check box MVC under “Add folders and core references for :” click OK.
Step 3 Now we are going to build model using entity framework and database first approach. I have explained in detail about Building model using entity framework and database first approach in this article “Simple Application to Demonstrate Form Posting in ASP.NET MVC” . Have a quick look at it.
Step 4 In this project I have build employee model. Then build your project as it is very important because now we will be using scaffolding feature.
Step 5 Now right click on “Controllers” -> Add -> controller give any name click Ok.
Step 6 Now select “MVC 5 Controller with views using Entity Framework” from Add Scaffold window. Scaffolding is the powerful feature in ASP.NET MVC which automatically generates code to Add Update Delete in ASP.NET without writing any Code.
Step 7 Add Model class and Data context class inside “Add Controller” window as I have added here.
Step 8 Now Everything is ready. Make sure you have added controller name in your RouteConfig.cs file in App_Start folder. Like here I am using employees controller.
Step 9 Build your project and Run. Your Application is ready now. Now you will be able to successfully add update delete in ASP.NET without writing any Code. Ta Da !
As you can see we have not written a single line of code here. All this is the magic of using ADO.NET Entity Model and Database First Approach, Entity Framework, and powerful scaffolding feature of ASP.NET MVC.
Latest posts by Amit Kulat (see all)
- What is Bitcoin ? How we can invest in Bitcoins ? - December 16, 2017
- Customization in Bar chart Horizontal Bar chart - November 26, 2017
- Implementing Bar chart and Pie chart using Chart.js - November 19, 2017