public async Task <Order> DeleteOrder(Order order) { var lineItems = await _orderLineItemRepository.GetOrderLineItems(order.OrderId); if (lineItems?.Any() == true) { throw new InMemoryRepositoryException($"Simulated Foreign Key Constraint - Line Items exist for order {order.OrderId}"); } return(await DeleteEntity(order)); }
private async Task <Order> BuildUpOrder(Order order) { if (order == null) { return(order); } var lineItems = await _orderLineItemRepository.GetOrderLineItems(order.OrderId); order.OrderLineItems = lineItems.ToList(); return(order); }