public ActionResult Edit(ItemMaster itemMaster) { if (ModelState.IsValid) { db.Entry(itemMaster).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(itemMaster)); }
public bool DeleteProduct(int id) { using (var _prodEntity = new ShopBridgeDBEntities()) { var _prod = _prodEntity.Items.Where(x => x.ItemID == id).FirstOrDefault(); if (_prod != null) { _prodEntity.Entry(_prod).State = EntityState.Deleted; _prodEntity.SaveChanges(); } } return(true); }