Esempio n. 1
0
        public void UpdateQuantity(int id, int quantity)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();
            BootCart cart = db.BootCarts.Find(id);

            cart.Price = quantity;

            db.SaveChanges();
        }
Esempio n. 2
0
        public void MarkBootsAsPaid(List <BootCart> carts)
        {
            db_1525596_co5027Entities db = new db_1525596_co5027Entities();

            if (carts != null)
            {
                foreach (BootCart cart in carts)
                {
                    BootCart PreviousCart = db.BootCarts.Find(cart.ID);
                    PreviousCart.DateBought = DateTime.Now;
                    PreviousCart.InsideCart = false;
                }
                db.SaveChanges();
            }
        }
Esempio n. 3
0
        public string InsertCart(BootCart cart)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                db.BootCarts.Add(cart);
                db.SaveChanges();

                return(cart.DateBought + " Inserted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Esempio n. 4
0
        public string DeleteCart(int id)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                BootCart cart = db.BootCarts.Find(id);

                db.BootCarts.Attach(cart);
                db.BootCarts.Remove(cart);
                db.SaveChanges();

                return(cart.DateBought + "Deleted Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Esempio n. 5
0
        public string UpdateCart(int id, BootCart cart)
        {
            try
            {
                db_1525596_co5027Entities db = new db_1525596_co5027Entities();
                //get the info from the db
                BootCart p = db.BootCarts.Find(id);

                p.DateBought = cart.DateBought;
                p.CustomerID = cart.CustomerID;
                p.Price      = cart.Price;
                p.InsideCart = cart.InsideCart;
                p.ProductID  = cart.ProductID;

                db.SaveChanges();
                return(cart.DateBought + " Updated Successfull");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }