Esempio n. 1
0
        public void CreateOrder(Library.PurOrder order)
        {
            decimal orderTotal = 0;

            order.OrderList = new List <Library.OrderList>();

            var cartItems = GetCartItems();

            foreach (var item in cartItems)
            {
                var orderDetail = new Library.OrderList
                {
                    ProductId = item.ProductId,
                    OrderId   = order.OrderId,
                    UnitPrice = Convert.ToDouble(item.Product.Cost),
                    Qty       = item.Qty
                };

                orderTotal += (item.Qty * Convert.ToDecimal(item.Product.Cost));
                order.OrderList.Add(orderDetail);

                //  _dbContext.OrderList.Add(orderDetail);
            }

            order.Total = orderTotal;


            _dbContext.SaveChanges();

            //EmptyCart();
        }
Esempio n. 2
0
 public static Entities.PurOrder Map(Library.PurOrder purorder) => new Entities.PurOrder
 {
     OrderId    = purorder.OrderId,
     CustomerId = purorder.CustomerId,
     StoreId    = purorder.StoreId,
     OrderDate  = purorder.OrderDate,
     Total      = purorder.Total,
     OrderList  = purorder.OrderList.Select(Map).ToList()
 };
Esempio n. 3
0
 Library.PurOrder IStoreRepo.CreateOrder(Library.PurOrder order)
 {
     throw new NotImplementedException();
 }