How it works...

The ASP.NET ModelBinding mechanism maps action method parameters to value providers. Value providers can be form data, route data, QueryString, and files. They can be any data sent through an HTTP request. We can also create our own value provider, but that will be explained in the next recipe.

The Form value provider is the posted data in an HTTP request. It consists of all the key-value pairs in the HTTP request body. The ModelBinding mechanism maps the name field values of the posted form with the properties of the class, to bind as the ActionResult parameter.

ActionResult parameters can be of the primitive type (short, int, double, string, char, and so on), or of simple types (such as Guid, DateTime, or TimeSpan) that ...

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.