public async Task <IActionResult> UpdateUser([FromBody] UserDto userDto) { _log.LogDebug($"REST request to update User : {userDto}"); var existingUser = await _userManager.FindByEmailAsync(userDto.Email); if (existingUser != null && !existingUser.Id.Equals(userDto.Id)) { throw new EmailAlreadyUsedException(); } existingUser = await _userManager.FindByNameAsync(userDto.Login); if (existingUser != null && !existingUser.Id.Equals(userDto.Id)) { throw new LoginAlreadyUsedException(); } var updatedUser = await _userService.UpdateUser(userDto); return(ActionResultUtil.WrapOrNotFound(updatedUser) .WithHeaders(HeaderUtil.CreateAlert("userManagement.updated", userDto.Login))); }