public ActionResult Create(School school) { if (ModelState.IsValid) { db.dbSet.Add(school); db.SaveChanges(); return RedirectToAction("Index"); } return View(school); }
public ActionResult AddSchool(School school) { if (ModelState.IsValid) { db.dbSet.Add(school); db.SaveChanges(); return RedirectToAction("Index"); } // If we got this far, something failed, redisplay form return View(school); }
public ActionResult Edit(School school) { if (ModelState.IsValid) { db.Entry(school).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(school); }