First MVC Application for Beginners

/
0 Comments

The MVC programming model is a lighter alternative to traditional ASP.NET (Web Forms). It is a lightweight, highly testable framework, integrated with all existing ASP.NET features, such as Master Pages, Security, and Authentication.

Create new Empty Project

in the above image, created new project with type of mvc 4.

Empty project template type with razor engine

Solution explorer with empty project template

we selected the empty project template while creating project so it is showing empty for controller section as well view section

Create new controller

Navigation for create

Controller name

After added

ViewBag used with controller

viewbag is used for transfer the values from controller to view. here, we used welcome for pass the welcome message.

Create new view

need create a folder

This folder name should be same as controller name.

Navigation for create

view name

After added

ViewBag used with view for display

This viewbag is passed from controller.

Update the default route

we need update the default controller and action names. because need update the newly created controller and action name.

In Browser




You may also like

No comments:

Powered by Blogger.