Example #1
0
        public void AddToCart(Car car)
        {
            carStoreContext.ShopCartItem.Add(new ShopCartItem
            {
                ShopCartId = ShopCartId,
                Car        = car,
                Price      = car.Price
            });

            carStoreContext.SaveChanges();
        }
Example #2
0
        public void CreateOrder(Order order)
        {
            order.OrderTime = DateTime.Now;
            carsStoreContext.Order.Add(order);

            carsStoreContext.SaveChanges();

            var items = shopCart.ListShopItems;

            foreach (var el in items)
            {
                var orderDetail = new OrderDetail()
                {
                    CarId   = el.Car.Id,
                    OrderId = order.Id,
                    Price   = el.Car.Price
                };
                carsStoreContext.OrderDetail.Add(orderDetail);
            }

            carsStoreContext.SaveChanges();
        }
Example #3
0
 public void AddUser(UserInfo user)
 {
     user.IsLoginUser = true;
     context.User.Add(user);
     context.SaveChanges();
 }