public ActionResult Delete(int id) { try { _shoppingListService.DeleteShoppingList(id); return(StatusCode(200)); } catch (Exception) { return(StatusCode(500)); } }
public async Task <ActionResult> DeleteShoppingList([FromRoute] string shoppingListId, CancellationToken cancellationToken) { try { await shoppingListService.DeleteShoppingList(shoppingListId.ToId(), cancellationToken); return(NoContent()); } catch (NotFoundException e) { logger.LogError(e, "Shopping list with id {ShoppingListId} does not exist", shoppingListId); return(NotFound()); } }