Three important MVC the components are:
Model: Contains all of the data as well as the logic that goes
with it.
View: Present data to the user or manage user interaction it's the
frontend which is visible to users.
Controller: A controller is a part that connects the Model and View
components.
View:
A view is the part of the application that reflects how data is
presented. The data obtained from the model data is used to construct views. A
view asks the model for details so that it can re-present the output to
the user.
The data from charts, diagrams, and tables is also shown in the view. Any
customer view, for example, would contain all UI elements such as text
boxes, drop downs, and so on.
Controller: Controller is the heart of MVC architecture. It is the component of the app that controls user interaction. The
controller interprets the user's mouse and keyboard inputs, causing the
model and display to adjust accordingly.
To change the model's state, a Controller sends commands to it (E.g., Saving
a specific document). In addition, the controller sends commands to its
related view to adjust the appearance of the view (For example scrolling a
particular document).
Model: The model part is where data and logic are stored. It
represents data that is passed between controller components or any other
business logic that is connected to it. A Controller object, for example,
can retrieve customer information from the database. It manipulates data
before sending it back to the database or rendering it.
It updates itself in response to requests from the views as well as guidance
from the controller. It's also the pattern's lowest level, and responsible
of data maintenance.
Example:
Every car is made up of three main components:
User interface = View (Gear shifter, panels, steering wheel, brake, and so on.)
Controller = Mechanism ( Engine)
Model Storage = ( Petrol or Diesel tank)
The car runs on an engine that draws fuel from a storage tank, but it only uses the user interface devices specified.
Summary:
- MVC is an architectural pattern that divides an application into three sections: 1) Model, 2) View, and 3) Controller.
- Model: It contains all of the data as well as the logic that goes with it.
- View: Present data to the user or manage user interaction in this view.
- Controller: A controller is a part that connects the Model and View components.
- Trygve Reenskaug first proposed the MVC architecture in 1979.
- MVC is a framework that is highly testable, extensible, and pluggable.
- Rails, Zend System, CodeIgniter, Laravel, Fuel PHP, and other common MVC frameworks are just a few examples.
For developing ASP.NET MVC application, you must have Microsoft .NET Framework 3.5 or higher. We have used .NET Framework 4 for developing the application.
Hope you enjoyed and learned something new, In case of any question, confusion or suggestion do comment below.
Happy Coding!
0 Comments