public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public ActionResult Edit(Province province) { if (ModelState.IsValid) { db.Entry(province).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(province)); }