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