public ActionResult Edit([Bind(Include = "StudentId,FirstName,LastName,StudentCode,PhoneNumber,Address,CourseId")] Student student) { if (ModelState.IsValid) { db.Entry(student).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(student)); }
public ActionResult Edit(int id, CustomerViewModel customerViewModel) { try { var customer = Mapper.Map <Customer>(customerViewModel); db.Entry(customer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }