Posted By : Murugan Andezuthu Dharmaratnam
Posted On : 22 January 2015
Keywords : Model,Model in MVC,Model view controller,Model basics,What is model

Model

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

  1. A model folder will be present under the created application's Solution Explorer.


  2. Right click on Model folder. A list will be appearing


  3. Select 'Add' option from list.Then a new list will be coming.


  4. Then select 'Class' option from list


  5. A new window appearing.Here give the name for the new class or model and select 'Add'.(Say model name as SampleModel)


  6. The newly added class will be appearing.That is, this will create a model class to the application.


  7. Inside this class, we can add properties as per the requirements. Example is given below.


Murugan Andezuthu Dharmaratnam

Murugan is a technology leader with 14 years of hands-on experience in full life cycle systems design, development, implementation, and management. In addition to systems design and development, his core competencies include cloud design and architecture, interactive web applications and websites development, mobile computing, and Healthcare Information Technology. His experience is very diverse with a broad range of technologies within multiple industry settings including private, public, and non-profit. Coupled with his technology expertise, Murugan is a well-organized, result-oriented, and a highly analytical leader with proven track record in developing and implementing very complex systems.