ASP.NET MVC Basics: Part 1

In this series we will learn the new design pattern provided by Microsoft called the MVC (Model-View-Controller). In this article we will start from what MVC is and then will discuss the following topics.
  1. What is MVC?
  2. How it is differ from Asp.Net?
  3. What is Asp.Net MVC?

What is MVC?

MVC stand for Model-View-Controller architecture. The following diagram can better explain the MVC structure.
You can clearly see from the preceding diagram how these three components are interrelated with each other. We will see each and every component of the architecture one by one. 
Controller is the first step of MVC which can be explained very well with the following points.
  1. A controller is responsible for controlling the way that a user interacts with an MVC application.
  2. A controller determines what response to send back to a user when a user makes a browser request.


The view can be defined as the following:  
  1. A view contains the HTML markup and content that is sent to the browser.
  2. A view is the equivalent of a page when working with an ASP.NET MVC application.
  3. We must create views in the right location. The HomeController.Index() action returns a view located at the following path: 

  4. The HomeController.About() action returns a view located at the following path:


The Model can be defined as.
  1. An MVC model contains all of your application logic that is not contained in a view or a controller
  2. The model will contain all of our application business logic and database access logic and other logic
  3.  DataLayer kind of classes, Types for data should be created in MVC model. 
In the next articles of this series, we will see most of the differences and advantages of using MVC.