MVC
Model-View-Controller
MVC is a design pattern used to decouple user-interface (view), data (model), and application logic (controller). This pattern helps to achieve separation of concerns.
Model
Responsible for bringing data to View.
Data Access Layer
Validation
Data Annotations
Client Validations
Remote Validations
View
Responsible for rendering UI.
Types
WebForm View (.aspx, .ascx, .master)
Razor View (.cshtml, .vbhtml)
@model - defines the type of data coming into the view
@Model - accesses the model data passed into the view
Razor View
Controller
Responsible for handling every user requests.
Responsible for building the model and selecting a view to render.
responsible for sending the data to the view.
Methods that return
IActionResult
are called Action methods and provide responses usable by browsers.
Last updated