Esempio n. 1
0
        public async Task <ActionResult> DeleteOrderItemAsync(int OrderId, int Id)
        {
            if (_OrderService.FindByIdAsync(OrderId) == null)
            {
                return(NotFound("This OrderId doesnt exist."));
            }

            var orderItem = await _OrderItemService.FindByIdAsync(Id);

            if ((orderItem == null) || (OrderId != orderItem.OrderId))
            {
                return(NotFound("This OrderaItem Id or Order Id does not exist."));
            }

            await _OrderItemService.DeleteOrderItemAsync(Id);

            return(Ok("This OrderItem Deleted"));
        }