public ActionResult Edit(int id, Student student) { try { using (DBModels dbModel = new DBModels()) { dbModel.Entry(student).State = System.Data.Entity.EntityState.Modified; dbModel.SaveChange(); } // TODO: Add update logic here return(RedirectToAction("Index")); } catch { return(View()); } }