Models In MVC

What is a Model?
Model is a class that represents domain specific data and business logic in a dot net application.

Adding A Model 
Right click the Models folder in the solution explorer->Add -> Class

After that Select Visual C#-> Class  and provide a suitable name for your model class

Sample Model Class

In Model validation logic can be added using Attributes in C# . Some validation attributes like StringLength,RegularExpression are used in the model.

Leave a Reply

Your email address will not be published. Required fields are marked *