Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces on computers. It divides a given software application into three interconnected parts, so as to separate internal representations of information from the ways that information is presented to or accepted from the user.
Traditionally used for desktop graphical user interfaces (GUIs), this architecture has become extremely popular for designing web applications.
MVC
The MVC(Model View Controller) separates an application into three main components.
This includes Model,View and Controller.
In this article, mainly explained about Models.
Models
Model represents an object. Model is resposible for maintaining the data
It respond to the request from view. It also respond to the instruction from controller for the updation.
Model objects retrieve and store model state in a database.
For example, a Student object might retrieve information from a StudentData Database, operate on it, and then write updated information back to a StudentData table in a SQL Server database.
In MVC, model both hold and manipulate application data. It contains all the application logic except view and controller logic
Model Folder contains the classes of application.
Model Adding
We can add models to our application with the following steps
- A model folder will be present under the created application's Solution Explorer.
- Right click on Model folder. A list will be appearing
- Select 'Add' option from list.Then a new list will be coming.
- Then select 'Class' option from list
- A new window appearing.Here give the name for the new class or model and select 'Add'.(Say model name as SampleModel)
- The newly added class will be appearing.That is, this will create a model class to the application.
- Inside this class, we can add properties as per the requirements. Example is given below.
HostForLIFE.eu ASP.NET MVC 4 Hosting
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes. We have customers from around the globe, spread across every continent. We serve the hosting needs of the business and professional, government and nonprofit, entertainment and personal use market segments.