Skip to content

Instantly share code, notes, and snippets.

@evgomes
Created January 31, 2019 13:19
Show Gist options
  • Save evgomes/9b71d67997d4d8596b8a930c654f3368 to your computer and use it in GitHub Desktop.
Save evgomes/9b71d67997d4d8596b8a930c654f3368 to your computer and use it in GitHub Desktop.
DeleteAsync from CategoriesController, of Supermarket API
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteAsync(int id)
{
var result = await _categoryService.DeleteAsync(id);
if (!result.Success)
return BadRequest(result.Message);
var categoryResource = _mapper.Map<Category, CategoryResource>(result.Category);
return Ok(categoryResource);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment