Coding

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 5

ASP.

NET MVC lab-1


Fundamental of Software Engineering :CSE 3205
1
Introduction
• ASP.NET MVC is basically a web development framework from
Microsoft, which combines the features of MVC (Model-View-
Controller) architecture
Task 1 – Creating the Model From the Database

1. Right-click the Models folder and select Add | New Item


2. In the Add New Item dialog, select Data in the Visual C# node, and then select ADO.NET Entity Data Model then
3. type model name.edmx
4. In the Choose Model Contents step, select EF Designer from database to specify that you will create the model
using the Database First approach. Click Next to continue
5. In the Choose Your Database Objects and Settings step, expand Tables | dbo and select table or view or function
6. In Solution Explorer, expand Models | ModelName.edmx as well as its ModelName.Context.tt and
ModelName.tt child nodes
7. Rebuild the project by open Build Menu and select rebuild Project
Creating a New project using MVC

1. From the main menu select File-new-project


2. From left side main menu select Visual C#- ASP.Net Web
application
3. Give the name of project then Ok
4. From template window Select MVC and then Ok
Task 2 – Generating a Controller and the Views from the Products entity

1. Select Build | Build Solution from the main menu to build the solution.
2. In Solution Explorer, right-click the Controllers folder and select Add |
Controller
3. In the Add Scaffold dialog, select MVC 5 Controller with views, using
Entity Framework and click Add.
4. For the Model class field, select the table and the Data context class to
Finally, click Add.
5. Run the project press F5
6. Type the name of the page (in our eg-Item/index)in the browser

You might also like