public void ShipperWithOrders_DeleteOrder_DetachOrderFromShipper() { const int shipperId = 3; var order = new Order { ShipperId = 3, ShippedDate = DateTimeOffset.UtcNow, ShipName = "Test Name" }; _shipperService.DeleteEntity(shipperId, order); Assert.Null(order.ShipperId); Assert.Null(order.ShippedDate); Assert.Null(order.ShipName); }
public async Task <ActionResult <OrderResponseModel> > DeleteShipperOrder(int shipperId, int orderId) { await DoesShipperExist(shipperId); var existingOrder = await GetOrder(shipperId, orderId); _shipperService.DeleteEntity(shipperId, existingOrder); if (await _shipperService.IsSavedToDb()) { return(Ok($"Order with id '{orderId}' of shipper " + $"with id {shipperId} has been deleted")); } return(BadRequest()); }