public void add(product obj) { using (Database1Entities db = new Database1Entities()) { db.products.Add(obj); db.SaveChanges(); } }
public void delete1(product obj) { using (Database1Entities db = new Database1Entities()) { var data = db.products.Find(obj.Id); db.products.Remove(data); db.SaveChanges(); } }
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(); } }