コード例 #1
0
ファイル: DepartmentAction.cs プロジェクト: chenchunwei/NPC
 public void UpdateDepartment(EditDepartmentModel model)
 {
     if (!model.Id.HasValue)
         throw new ArgumentException("model.id不能为null");
     var department = _departmentRepository.Find(model.Id.Value);
     department.Name = model.FormData.Name;
     department.Unit = NpcContext.CurrentUser.Unit;
     department.RecordDescription.UpdateBy(NpcContext.CurrentUser);
     _departmentRepository.Save(department);
 }
コード例 #2
0
ファイル: DepartmentAction.cs プロジェクト: chenchunwei/NPC
 public void CreateNewDepartment(EditDepartmentModel model)
 {
     var department = new Department();
     department.Name = model.FormData.Name;
     department.Unit = NpcContext.CurrentUser.Unit;
     if (model.ParentId.HasValue)
         department.Parent = _departmentRepository.Find(model.ParentId.Value);
     department.RecordDescription.CreateBy(NpcContext.CurrentUser);
     _departmentRepository.Save(department);
 }
コード例 #3
0
 public JsonResult EditUnitPost(EditDepartmentModel model)
 {
     try
     {
         _departmentAction.CreateNewDepartment(model);
     }
     catch (Exception)
     {
         return new NewtonsoftJsonResult() { Data = new { status = "failure" } };
     }
     return new NewtonsoftJsonResult() { Data = new { status = "success" } };
 }