Virtual Classes Logo          Virtual Classes
    Read Anytime,Anywhere

MVC

MVC stands Model View Controller is a software architectural pattern divides a software application into three interconnected parts.
1-Model:-Model in MVC handles the logic for the application data, it act as business layer.
2-View:- View in MVC used to display the data hold by the model.Most often the views are created from the model data.
3-Controller:-Controller in MVC handles user interaction. Controllers read data from a view, control user input, and send input data to the model.

Create your first MVC project
1-Click File menu --> New --> Project
It will open a dialog box as shown in below image.Choose ASP.NET MVC4 web application. Give a name to the solution and click ok.
Create your first MVC project

2-After clicking OK it will ask you to choose your project template and view engine. MVC 4 has given you 6 template and two view engive to render your view.
MVC templates
1-Empty Application-Provides the minimum references and resources required to run an Asp.net MVC application.
2-Basic Application-It’s a new project type in MVC 4 and it was not available in MVC3. It includes Content and Scripts as well as few more references. Bundling and minimization facilities have been prepared in this template. BundleConfig.cs file has been added to App_Start folder.
3-Internet ApplicationInternet Application Template comes with Membership management functionality which allows you register, login, change password and so on Its a template used usually to start a normal web project in action.
4-Intranet Application Interanet Application is same as Internet Application except for Membership management. When you choose Intranet Template web.config has been configured to use Windows as it’s authentication method.
5-Mobile Application-Mobile website programming is one of most important feature in MVC 4 so this template has everything that Internet Application template has, however it is using jQuery.mobile instead.
6-Web API Application-If want to create an application or service to support verify of client then web API makes it easy to develop RESTful web services and applications. It allows you to expose your data and service to the web directly over Http.


MVC Solution explorer
As you can see in above image the solution structure of MVC application.
The soultion has Contollers folder which holds the controller used in project,View folder will hold views those will be used in application. There is one more folder inside view the shared folder, the shared folder holds shared views(master page in ASP.NET),Model folder will hold the models those will be used in project. Content folder will hold the theme and CSS those will be used in application and Scripts will hold scripts.
Click on links in right hand side to understand each MVC concepts clearly.