0% found this document useful (0 votes)
121 views

MVC Notes v1.0

The document outlines a 6 step process for creating an ASP.NET MVC4 application that accesses data using Entity Framework. The steps are: 1) Create an ASP.NET MVC4 application; 2) Install Entity Framework using NuGet; 3) Create an "Employee" class model; 4) Add an "EmployeeController" controller; 5) Add code to the controller action to retrieve employee data from the database and pass it to the view; 6) Create a view to display the employee data. The process allows building an MVC web application that uses Entity Framework to access and display data from a SQL database table.

Uploaded by

radhikarads
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views

MVC Notes v1.0

The document outlines a 6 step process for creating an ASP.NET MVC4 application that accesses data using Entity Framework. The steps are: 1) Create an ASP.NET MVC4 application; 2) Install Entity Framework using NuGet; 3) Create an "Employee" class model; 4) Add an "EmployeeController" controller; 5) Add code to the controller action to retrieve employee data from the database and pass it to the view; 6) Create a view to display the employee data. The process allows building an MVC web application that uses Entity Framework to access and display data from a SQL database table.

Uploaded by

radhikarads
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 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.

You might also like