public ActionResult Create(AC_DepartmentModel model)
 {
     if (ModelState.IsValid)
     {
         ResultModel resultModel = new ResultModel();
         if (model.ID == 0)
         {
             model.CreateBy = UserInfo.CurrentUserName;
             model.CreateDT = DateTime.Now;
             model.UpdateBy = model.CreateBy;
             model.UpdateDT = model.CreateDT;
             model.ParentID = 0;
             var result = _ACDepartmentService.AddAC_Department(model);
             resultModel.Messages = new List <string> {
                 result.Data.ID > 0 ? "Add dept success" : "Add dept failed"
             };
         }
         else
         {
             model.UpdateBy = UserInfo.CurrentUserName;
             model.UpdateDT = DateTime.Now;
             var result = _ACDepartmentService.UpdateAC_Department(model);
             resultModel.Messages = new List <string> {
                 "Edit dept success"
             };
         }
         return(Json(resultModel, JsonRequestBehavior.AllowGet));
     }
     return(PartialView(model));
 }
        public void AC_DepartmentService_UpdateAC_Department_Test()
        {
            var entity = new AC_DepartmentModel
            {
                ID          = 2,
                DeptName    = "技术部22",
                IsActive    = 1,
                OrderNumber = 0,
                ParentID    = 0,
                CreateBy    = "admin",
                CreateDT    = DateTime.Now,
                UpdateBy    = "admin",
                UpdateDT    = DateTime.Now
            };

            var resultModel = _acDepartmentService.UpdateAC_Department(entity);

            Assert.IsTrue(resultModel.Data == true);

            var resuleModelUpdated = _acDepartmentService.GetAC_DepartmentById(entity.ID);

            Assert.IsTrue(resuleModelUpdated.Data.DeptName == "技术部22");
        }