public ActionResult DepartmentEdit(string id) { if (!string.IsNullOrEmpty(id)) { int dpId = Convert.ToInt32(EncryptHelper.DesDecrypt(id)); var model = HomeBusiness.GetDepartById(dpId); return(Json(model, JsonRequestBehavior.AllowGet)); } return(View(new DepartmentInfo())); }
/// <summary> /// 描述:新建部门 /// </summary> /// <param name="departmentId">部门Id</param> /// <param name="level">level为1表示新建平级部门</param> /// <returns></returns> public ActionResult DepartmentCreate(string departmentId, int level) { if (!string.IsNullOrEmpty(departmentId)) { int dpId = Convert.ToInt32(EncryptHelper.DesDecrypt(departmentId)); DepartmentInfo model; if (level == 1) //1表示新建平级 { model = HomeBusiness.GetDepartById(dpId); } else { model = HomeBusiness.GetDepartById(dpId); model.ParentId = model.Id; model.ParentName = model.Name; } return(Json(model, JsonRequestBehavior.AllowGet)); } return(View()); }