Anda di halaman 1dari 8

Chapter -1

ASP.NET MVC4 APPLICATION:


DATA ACCESS USING ENITY FRAMEWORK
Assumption:
Database Name: Sample
Table Name: tblEmployee
Table Contents:

SIX STEP PROCESS:


1. Create ASP.NET MVC4 Application:

Click OK.

2. Install Entity Framework using NuGet packet manager:

3. Create a new class Employee inside the Model folder as illustrated below:

Click Add. The following screen shall appear:

Note: The new class has been created in the namespace MVCDemo.Models
Insert the following code:
public class Employee
{

public
public
public
public
}

int EmployeeID { get; set; }


string Name {get; set;}
string Gender { get; set; }
string City { get; set; }

4. Add a controller EmployeeController:

Note: The EmployeeController has been created in the namespace


MVCDemo.Controllers
Change the action method name from Index to Details and add the following
code:

5.

Anda mungkin juga menyukai