Пример #1
0
        public IList <OrderFulfillment> SaveAutOrderFulfillments(Order order)
        {
            var fulfillments = GetAutoOrderFulfillments(order);

            if (fulfillments != null)
            {
                Transaction.Initiate(transaction =>
                {
                    foreach (var fulfillment in fulfillments)
                    {
                        fulfillment.WarehouseInventory.ReservedQuantity += fulfillment.Quantity;
                        //update inventory
                        _warehouseInventoryService.Update(fulfillment.WarehouseInventory, transaction);
                        _orderFulfillmentService.Insert(fulfillment, transaction);
                    }
                });
            }

            return(fulfillments);
        }