public ActionResult Edit(int id) { ViewBag.id = id; var allDeparts = DepartmentManager.GetAllDbRecords(); allDeparts.Insert(0, new Department { ID = 0, Name = "<根部门>" }); ViewBag.AllDepartments = allDeparts; var model = DepartmentManager.GetDbRecord(id); return(PartialView(model)); }
public ActionResult Page(int id = 0) { var model = DepartmentManager.GetDbRecord(id); if (model == null) { model = new Department { Name = "<根部门>", ParentID = 0 }; } ViewBag.Parent = DepartmentManager.GetParentDepartment(id); ViewBag.Subs = DepartmentManager.GetSubDepartments(id); ViewBag.Users = DepartmentManager.GetUsers(id); return(View(model)); }