Category «MVC – Model»

Data Annotations in ASP.NET MVC Application

Data Annotation is one of the best approach to implement validation in ASP.Net MVC application. It’s depends on System.ComponentModel.DataAnnotations assembly and Data Annotation has a set of attributes and classes. public class EmployeeVM{ [Required(ErrorMessage = “The ID is required.”)] public int Id { get; set; }   [Required(ErrorMessage = “The name is required.”)] public string …

ASP.NET MVC : Model Binding

Model binding in MVC maps data from HTTP requests to action method parameters. The parameters may be simple types such as strings, integers, or floats, or they may be complex types. This is a great feature of MVC because mapping incoming data to a counterpart is an often repeated scenario, regardless of size or complexity …