public MediatorResponse <AccountUnlockViewModel> Unlock(AccountUnlockViewModel accountUnlockView) { var validationResult = _accountUnlockViewModelServerValidator.Validate(accountUnlockView); if (!validationResult.IsValid) { return(GetMediatorResponse(LoginMediatorCodes.Unlock.ValidationError, accountUnlockView, validationResult)); } var accountUnlockViewModel = _candidateServiceProvider.VerifyAccountUnlockCode(accountUnlockView); switch (accountUnlockViewModel.Status) { case AccountUnlockState.Ok: return(GetMediatorResponse(LoginMediatorCodes.Unlock.UnlockedSuccessfully, accountUnlockView)); case AccountUnlockState.UserInIncorrectState: return(GetMediatorResponse(LoginMediatorCodes.Unlock.UserInIncorrectState, accountUnlockView)); case AccountUnlockState.AccountEmailAddressOrUnlockCodeInvalid: return(GetMediatorResponse(LoginMediatorCodes.Unlock.AccountEmailAddressOrUnlockCodeInvalid, accountUnlockView, AccountUnlockPageMessages.WrongEmailAddressOrAccountUnlockCodeErrorText, UserMessageLevel.Error)); case AccountUnlockState.AccountUnlockCodeExpired: return(GetMediatorResponse(LoginMediatorCodes.Unlock.AccountUnlockCodeExpired, accountUnlockView, AccountUnlockPageMessages.AccountUnlockCodeExpired, UserMessageLevel.Warning)); default: return(GetMediatorResponse(LoginMediatorCodes.Unlock.AccountUnlockFailed, accountUnlockView, AccountUnlockPageMessages.AccountUnlockFailed, UserMessageLevel.Warning)); } }