Create Entity Data Model Insert Update delete code using MVC with Linq to Entity frame work

Using MVC How We can create Entity framework Data model.

1. Create database and new project in visual studio.

2. In solution explorer select Model and add new Item.

add new item

3. Select Ado.Net Entity Data model.press Add.

ado dot net

4. Select generate from database. press next.

connection

5. Select Yes from Drop down and press Next.

select data connection

6. Select Table you need and press Finish.

select table

7. Model1.edmx created in the model. now we can use this model in View and controller to perform the Insert, Update and Delete operation. Following Model1.edmx save and close it.

model

8. Now how we can Access this table in Controller and View. You need to write following name space in controller.

  1. using logindemo.Models;  
logindemo is the project name.

Code for insert, Update, delete and View.

Screen For code:

code

program

program code