示例#1
0
        public ActionResult <CartProduct> DeleteProductFromCart([FromBody] ProductToDeleteFromCartDto productToDelete)
        {
            var client = clientService.GetClientById(productToDelete.ClientId);

            if (client == null)
            {
                return(NotFound());
            }

            var product = productService.GetProductById(productToDelete.ProductId);

            if (product == null)
            {
                return(NotFound());
            }

            var deletedProduct = cartProductService.RemoveProduct(client.Id, product.Id);

            return(Ok(deletedProduct));
        }