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")); }
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()); }