Here we use Entity Framework 6 with MVC5.
- First here is our SQL table:
![SQL Table]()
- So for this tutorial first we will create a new empty MVC application. In this we will add an ADO.Net entity data model to the Model as in the following:
![new model]()
- Select "EF Designer from database".
![EF designer from database]()
- Then select Server name and Database name.
![servername databasen]()
- Select the Yes radio button and click on "Next".
![yes radio button]()
- Select "Entity Framework 6.x".
![entity framework]()
- Then select the table.
![select table]()
- Now MVCdb.edmx has been added to the Model folder.
![model folder]()
- Now add an Employee Controller as in the following:
![employee controller]()
- Choose "MVC5 Controller with views, using Entity Framework".
![choose mvc5 controller]()
- Select Model class and DataContextClass and provide the Controller name Employee.
![selecct model class]()
- So now, automatically create an Index, Create, Delete, Edit and Details Views and Controller actions.
![cs program]()
- Now run the application (Ctrl+F5).
![run application]()
- Click on "Create New".
![create new]()
- Add data and click on the Create button.
![add data]()