Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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);
        }