Commit b020fb22 authored by Almouhannad's avatar Almouhannad

(B) Change update user behavior

parent 6949ca50
...@@ -27,18 +27,26 @@ public class UpdateDoctorUserHandler : CommandHandlerBase<UpdateDoctorUserComman ...@@ -27,18 +27,26 @@ public class UpdateDoctorUserHandler : CommandHandlerBase<UpdateDoctorUserComman
#endregion #endregion
#region 2. Check unique username #region 2. Check unique username
var uniqueUserNameResult = await _userRepository.IsUserNameAvailableAsunc(request.UserName); if (user.User.UserName != request.UserName) // Unchanged user name, so just changing password
if (uniqueUserNameResult.IsFailure) {
return Result.Failure(uniqueUserNameResult.Error); var uniqueUserNameResult = await _userRepository.IsUserNameAvailableAsunc(request.UserName);
if (uniqueUserNameResult.Value == false) if (uniqueUserNameResult.IsFailure)
return Result.Failure(IdentityErrors.TakenUserName); return Result.Failure(uniqueUserNameResult.Error);
if (uniqueUserNameResult.Value == false)
return Result.Failure(IdentityErrors.TakenUserName);
}
#endregion #endregion
#region 3. change username #region 3. change username
var updateUserNameResult = await _userRepository.ChangeUserName(user.User, request.UserName); if (user.User.UserName != request.UserName) // Unchanged user name, so just changing password
if (updateUserNameResult.IsFailure) {
return Result.Failure(updateUserNameResult.Error); var updateUserNameResult = await _userRepository.ChangeUserName(user.User, request.UserName);
if (updateUserNameResult.IsFailure)
return Result.Failure(updateUserNameResult.Error);
}
#endregion #endregion
#region 4. Change password #region 4. Change password
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment