public async Task <string> Update(UpdateUserInput input) { input.CheckDataAnnotations().CheckValidResult(); await _userDomainService.Update(input); return("更新员工信息成功"); }
public async Task <string> Update(UpdateUserInput input) { input.CheckDataAnnotations().CheckValidResult(); var userInfo = await _userRepository.SingleOrDefaultAsync(p => p.Id == input.Id); if (userInfo == null) { throw new BusinessException($"不存在Id为{input.Id}的用户信息"); } if (input.Email != userInfo.Email) { var exsitUser = await _userRepository.FirstOrDefaultAsync(p => p.Email == input.Email); if (exsitUser != null) { throw new BusinessException($"系统中已经存在{input.Email}的用户信息"); } } if (input.Phone != userInfo.Phone) { var exsitUser = await _userRepository.FirstOrDefaultAsync(p => p.Phone == input.Phone); if (exsitUser != null) { throw new BusinessException($"系统中已经存在{input.Phone}的用户信息"); } } userInfo = input.MapTo(userInfo); await _userRepository.UpdateAsync(userInfo); return("更新员工信息成功"); }
public async Task <string> Update(UpdateUserInput input) { input.CheckDataAnnotations().CheckValidResult(); _session.CheckLoginUserDataPermision(input.OrgId, "您没有将用户设置为该部门的权限"); await _userDomainService.Update(input); return("更新员工信息成功"); }