Introduction

One of the major changes happening in ASP.NET vNext is the changes happening in MVC. The next version of ASP.NET will come with MVC6 – where the Web API, MVC and Web Pages framework are merged into one framework. This new framework has been christened MVC6. With this new unified framework, we now have a unified controller and routing concepts. It is now possible to have a single controller that can return MVC views as well as Web API responses on the same HTTP verb.

Overview of Model View Controller (MVC)

Here is a quick overview of MVC for readers who aren’t familiar with it.

Model-View-Controller is a pattern for building an UI, which divides software into three interconnected parts, (a) model - consisting of application data, business rules, logic and functions; (b) view – this represents output; and (c) controller – which accepts inputs and converts it to commands for the model or view.

ASP.NET MVC is lightweight, highly testable presentation framework that is defined in the System.Web.Mvc namespace and is a supported part of the System.Web namespace. It provides integration with ASP.NET features like master pages and membership-based applications.

Add a new folder in the solution called Controllers and then right-click on the folder name in Solution Explore and select Add-> New Item and choose MVC Controller class and click Add.

Add MVC Controller Class

Next, we will create a View class. To do that, we will first add a folder called Views and a sub-folder called Home. Then, Right-click on the folder name in Solution Explorer and select Add-> New Item and choose MVC5 View Page and click Add.

Add MVC5 View Page

Change the default contents of the index.cshtml file as shown below (changes are highlighted).

About the author

Vipul Patel is a Program Manager currently working at Amazon Corporation. He has formerly worked at Microsoft in the Lync team and in the .NET team (in the Base Class libraries and the Debugging and Profiling team). He can be reached at vipul.patel@hotmail.com