public async Task <IActionResult> UpdatePassword(string id, [FromBody] PasswordUserViewModel passwordUserViewModel)
        {
            if (!_userService.Exist(id))
            {
                return(NotFound());
            }

            if (!await _userService.CheckPassword(passwordUserViewModel.Id, passwordUserViewModel.CurrentPassword))
            {
                ModelState.AddModelError(nameof(passwordUserViewModel.CurrentPassword), "The password you provided is wrong");
                return(BadRequest(ModelState));
            }

            if (!PasswordChecker.ValidatePassword(passwordUserViewModel.NewPassword, out var message))
            {
                ModelState.AddModelError(nameof(passwordUserViewModel.NewPassword), message);
                return(BadRequest(ModelState));
            }

            var userDTO = UserMapper.PasswordUserViewModelToDTO(passwordUserViewModel);

            await _userService.UpdatePassword(userDTO);

            return(NoContent());
        }
 public static UserDTO PasswordUserViewModelToDTO(PasswordUserViewModel passwordUserViewModel)
 {
     return(new UserDTO
     {
         Id = passwordUserViewModel.Id,
         Password = passwordUserViewModel.CurrentPassword,
         NewPassword = passwordUserViewModel.NewPassword
     });
 }