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.
Used to check if bound model passed validation:
if (!ModelState.IsValid) {
return BadRequest(ModelState);
MVC automatically adds errors to ModelState based on validation attributes.