public void Add(AddDepartmentInput input) { input.Validate(); Sys_Department entity = this.CreateEntity <Sys_Department>(); entity.Name = input.Name; entity.EnCode = input.EnCode; entity.Manager = input.Manager; entity.Telephone = input.Telephone; entity.MobilePhone = input.MobilePhone; entity.WeChat = input.WeChat; entity.Fax = input.Fax; entity.Email = input.Email; entity.SortCode = input.SortCode; entity.Description = input.Description; this.DbContext.Insert(entity); }
public Task <Guid> Add(AddDepartmentInput input) { _userService.CheckUserPermissions(new List <Enum.RoleType> { Enum.RoleType.Administrator }); if (_departmentRepository.Count(t => t.Name == input.Name && t.IsDeleted == false) > 0) { throw new UserFriendlyException("系【" + input.Name + "】已经存在"); } var user = _userService.UserClaim(); return(_departmentRepository.InsertAndGetIdAsync(new DepartmentEntity { CreateUserId = user.UserId, Id = Guid.NewGuid(), IsDeleted = false, Name = input.Name, UpdateUserId = user.UserId })); }
//[ValidateAntiForgeryToken] public ActionResult Add(AddDepartmentInput input) { input.CreateUserId = this.CurrentSession.UserId; this.CreateService <IEntityAppService>().AddFromDto <Sys_Department, AddDepartmentInput>(input); return(this.AddSuccessMsg()); }
//[ValidateAntiForgeryToken] public ActionResult Add(AddDepartmentInput input) { this.CreateService <IDepartmentAppService>().Add(input); return(this.AddSuccessMsg()); }