예제 #1
0
        public ActionResult DeleteOrderItem(int OrderId, int Id)
        {
            if (_OrderService.FindById(OrderId) == null)
            {
                return(NotFound("This OrderId doesnt exist."));
            }

            var orderItem = _OrderItemService.FindById(Id);

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

            _OrderItemService.DeleteOrderItem(Id);
            return(Ok("This OrderItem Deleted"));
        }
예제 #2
0
        public async Task <ActionResult> DeleteOrderItemAsync(
            CallOffId callOffId,
            CatalogueItemId catalogueItemId)
        {
            var order = await orderItemService.GetOrderWithCatalogueItems(callOffId);

            if (order is null || order.IsDeleted)
            {
                return(NotFound());
            }

            if (await orderItemService.DeleteOrderItem(order, catalogueItemId) < 1)
            {
                return(NotFound());
            }

            return(NoContent());
        }