Mid ASP.NET Core

Model state: checking ModelState.IsValid?

Used to check if bound model passed validation:

if (!ModelState.IsValid) {

return BadRequest(ModelState);

MVC automatically adds errors to ModelState based on validation attributes.

More from ASP.NET Core Tutorial

All questions for this course