Skip to content

Instantly share code, notes, and snippets.

@evgomes
Created January 30, 2019 12:49
Show Gist options
  • Save evgomes/5dc3359cac70cb98cb167d2a18a28465 to your computer and use it in GitHub Desktop.
Save evgomes/5dc3359cac70cb98cb167d2a18a28465 to your computer and use it in GitHub Desktop.
POST endpoint validating ModelState, from CategoriesController of Supermarket API
[HttpPost]
public async Task<IActionResult> PostAsync([FromBody] SaveCategoryResource resource)
{
if (!ModelState.IsValid)
return BadRequest(ModelState.GetErrorMessages());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment