//CreateBasket
        public Basket CreateBasket(BasketOption baskOption)
        {
            CustomerManagement cstMng = new CustomerManagement(db);
            Basket             basket = new Basket
            {
                Customer = cstMng.FindCustomerById(baskOption.CustomerId)
            };

            db.Baskets.Add(basket);
            db.SaveChanges();
            return(basket);
        }
示例#2
0
        public BasketProduct AddProduct(BasketProductOption bskProd)
        {
            CustomerManagement cstMng        = new CustomerManagement(db);
            BasketProduct      basketProduct = new BasketProduct
            {
                Basket  = db.Baskets.Find(bskProd.BasketId),
                Product = db.Products.Find(bskProd.ProductId)
            };

            db.BasketProducts.Add(basketProduct);
            db.SaveChanges();
            return(basketProduct);
        }
示例#3
0
        //Create Basket
        public Basket CreateBasket(BasketOption baskOption)
        {
            CustomerManagement castMangr = new CustomerManagement(db);
            Basket             basket    = new Basket
            {
                Customer = castMangr.FindCustomerById(baskOption.CustomerId)
            };

            //  db.Database.EnsureCreated();
            db.Baskets.Add(basket);
            db.SaveChanges();
            return(basket);
        }