예제 #1
0
        public void add(product obj)
        {
            using (Database1Entities db = new Database1Entities())
            {

                db.products.Add(obj);
                db.SaveChanges();
            }
        }
예제 #2
0
        public void save(admin obj)
        {
            using (Database1Entities db = new Database1Entities())
            {

                db.admins.Add(obj);
                db.SaveChanges();
            }
        }
예제 #3
0
        public void delete1(product obj)
        {
            using (Database1Entities db = new Database1Entities())
            {
                var data = db.products.Find(obj.Id);
                db.products.Remove(data);

                db.SaveChanges();

            }
        }
예제 #4
0
        public void update1(product obj)
        {
            using (Database1Entities db = new Database1Entities())
            {
                product product2=db.products.Find(obj.Id);
                product2.pName = obj.pName;
                product2.category = obj.category;
                product2.price = obj.price;
                product2.description = obj.description;
                product2.image = obj.image;
                db.SaveChanges();

            }
        }