Ejemplo n.º 1
0
        public async Task <OrderClientDTO> PlaceOrder(int userId, int customerId, int orderId, OrderItem[] items, decimal totalPrice = 0.00m)
        {
            var suborder = orderDetailRepository.AutoAdd(new OrderDetail()
            {
                OrderId = orderId, OrderStatusId = 1
            });

            if (suborder != null)
            {
                foreach (var i in items)
                {
                    subOrderDetailRepository.Add(new SubOrderDetail()
                    {
                        SubOrderId       = suborder.SubOrderId,
                        ItemId           = i.ItemId,
                        OrderQuantity    = i.Quantity,
                        OrderPreferences = i.Prefences
                    });
                }

                Save();
            }

            return(await GetCustomerCurrentOrders(customerId, userId, orderId));
        }