Exemplo n.º 1
0
        private async Task <IActionResult> ConfirmEmail(string userId, string confirmationCode)
        {
            var emailConfirmationResult = await
                                          _emailConfirmationService.ConfirmEmailAsync(userId, confirmationCode);

            if (emailConfirmationResult.Success)
            {
                return(null);
            }
            switch (emailConfirmationResult.ResultCode)
            {
            case EmailConfirmationErrorResultCodes.EmailAlreadyConfirmed:
                return(BadRequest(new EmailAlreadyConfirmedResponse()));

            case EmailConfirmationErrorResultCodes.UserNotFound:
                return(NotFound(new NotFoundResponse <User>()));

            case EmailConfirmationErrorResultCodes.InvalidToken:
                return(BadRequest(new CantConfirmEmailResponse()));

            default:
                return(BadRequest(new CantConfirmEmailResponse()));
            }
        }