public ActionResult Create(Teacher teacher) { if (ModelState.IsValid) { db.Teachers.Add(teacher); db.SaveChanges(); return RedirectToAction("Index"); } return View(teacher); }
public ActionResult Edit(Teacher teacher) { if (ModelState.IsValid) { db.Entry(teacher).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(teacher); }