Ejemplo n.º 1
0
        public void UpdateQ(int id, int quantity)
        {
            db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();
            tblPurchase p = db.tblPurchases.Find(id);

            p.LP_price = quantity;

            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public string InsertLaptopType(tblLaptop product)
        {
            try
            {
                db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();
                db.tblLaptops.Add(product);
                db.SaveChanges();

                return(product.LP_name + "-Succesfully Add");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Ejemplo n.º 3
0
        public string InsertPurchase(tblPurchase product)
        {
            try
            {
                db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();
                db.tblPurchases.Add(product);
                db.SaveChanges();

                return(product.LP_date + "-Succesfully Add");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Ejemplo n.º 4
0
        public void MOAPaid(List <tblPurchase> carts)
        {
            db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();

            if (carts != null)
            {
                foreach (tblPurchase cart in carts)
                {
                    tblPurchase oldCart = db.tblPurchases.Find(cart.ID);
                    oldCart.LP_date = DateTime.Now;
                    oldCart.in_Cart = false;
                }
                db.SaveChanges();
            }
        }
Ejemplo n.º 5
0
        public string DeleteLaptopType(int id)
        {
            try
            {
                db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();
                tblLaptop product = db.tblLaptops.Find(id);

                db.tblLaptops.Attach(product);
                db.tblLaptops.Remove(product);
                db.SaveChanges();

                return(product.LP_name + "-Succesfully deleted");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Ejemplo n.º 6
0
        public string UpdateLaptopType(int id, tblLaptop product)
        {
            try
            {
                db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();

                //get the table from db
                tblLaptop pro = db.tblLaptops.Find(id);
                pro.LP_name = product.LP_name;

                db.SaveChanges();
                return(product.LP_name + "-Succesfully updated");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }
Ejemplo n.º 7
0
        public string UpdatePurchase(int id, tblPurchase product)
        {
            try
            {
                db_1430757_co5027_naftechEntities db = new db_1430757_co5027_naftechEntities();

                //ge the table from db
                tblPurchase pro = db.tblPurchases.Find(id);

                pro.cust_ID  = product.cust_ID;
                pro.LP_ID    = product.LP_ID;
                pro.LP_price = product.LP_price;
                pro.LP_date  = product.LP_date;
                pro.in_Cart  = product.in_Cart;

                db.SaveChanges();
                return(product.LP_date + "-Succesfully updated");
            }
            catch (Exception e)
            {
                return("Error:" + e);
            }
        }