Пример #1
0
        public async Task <ActionResult <ShoppingCartItem> > DeleteShoppingCartItem(int shoppingCartItemId)
        {
            try
            {
                var shoppingCartItemToDelete = await _shoppingCartItemRepository.GetShoppingCartItem(shoppingCartItemId);

                if (shoppingCartItemToDelete == null)
                {
                    return(NotFound($"Shopping cart item with Id = {shoppingCartItemId} not found"));
                }

                return(await _shoppingCartItemRepository.DelteShopingCartItem(shoppingCartItemId));
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error deleting data"));
            }
        }