コード例 #1
0
 public ActionResult Delete(int id)
 {
     try
     {
         _shoppingListService.DeleteShoppingList(id);
         return(StatusCode(200));
     }
     catch (Exception)
     {
         return(StatusCode(500));
     }
 }
コード例 #2
0
        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());
            }
        }