ASP.NET MVC Basics: Part 1


Introduction:
 
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.
MVC.png
 
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
 
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.

VIEW

 
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: 

    \Views\Home\Index.aspx
  4. The HomeController.About() action returns a view located at the following path:
    \Views\Home\About.aspx 

MODEL

 
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. 
Conclusion
 
In the next articles of this series, we will see most of the differences and advantages of using MVC.


Similar Articles