public async Task UpdateDataAsync(UserEditInputDTO input) { if (input.Id == GlobalData.ADMINID && _operator?.UserId != input.Id) { throw new BusException("禁止更改超级管理员!"); } await UpdateAsync(_mapper.Map <Base_User>(input)); await SetUserRoleAsync(input.Id, input.RoleIdList); await _userCache.UpdateCacheAsync(input.Id); }
public async Task AddDataAsync(UserEditInputDTO input) { input.Last_Interview_Project = input.ProjectIdList.FirstOrDefault(x => x == input.Last_Interview_Project) ?? input.ProjectIdList.FirstOrDefault(); var usercount = await GetIQueryable().CountAsync(x => x.UserName == input.UserName.Trim()); if (usercount > 0) { throw new BusException($"用户名{input.UserName}已存在"); } await InsertAsync(_mapper.Map <Base_User>(input)); await SetUserRoleAndProjectAsync(input.Id, input.RoleIdList, input.ProjectIdList); }
public async Task UpdateDataAsync(UserEditInputDTO input) { if (input.Id == GlobalData.ADMINID && _operator?.UserId != input.Id) { throw new BusException("禁止更改超级管理员!"); } var usercount = await GetIQueryable().CountAsync(x => x.UserName == input.UserName.Trim()); if (usercount > 1) { throw new BusException($"该用户名{input.UserName}已存在"); } input.Last_Interview_Project = input.ProjectIdList.FirstOrDefault(x => x == input.Last_Interview_Project) ?? input.ProjectIdList.FirstOrDefault(); await UpdateAsync(_mapper.Map <Base_User>(input)); await SetUserRoleAndProjectAsync(input.Id, input.RoleIdList, input.ProjectIdList); await _userCache.UpdateCacheAsync(input.Id); }
public async Task AddDataAsync(UserEditInputDTO input) { await InsertAsync(_mapper.Map <Base_User>(input)); await SetUserRoleAsync(input.Id, input.RoleIdList); }