Created
January 30, 2019 13:31
-
-
Save evgomes/649cbd51b40920304fdef47e0b9a182d to your computer and use it in GitHub Desktop.
POST endpoint with mapping, from CategoriesController of Supermarket API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
public async Task<IActionResult> PostAsync([FromBody] SaveCategoryResource resource) | |
{ | |
if (!ModelState.IsValid) | |
return BadRequest(ModelState.GetErrorMessages()); | |
var category = _mapper.Map<SaveCategoryResource, Category>(resource); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment