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); }
public ActionResult GetDepartmentAndAll() { var list = Db.Departments.Where(u => u.Verify == 0).ToList(); var all = new Department() { Abbreviation = "全部", Id = 0, IsStop = 0, Name = "全部", Verify = 0 }; list.Insert(0, all); return Json(list); }