Ejemplo n.º 1
0
    public async Task <Result> VerifyEmailAsync(ModelVerification modelVerification)
    {
        using (IDbConnection conn = Connection)
        {
            try
            {
                _logger.LogDebug(modelVerification.Code + ".." + modelVerification.Email);
                string sQuery = @"UPDATE UserCredentials SET 
                    Verified = 1
                    WHERE Email = @Email AND 
                    VerificationCode = @VerificationCode;";
                conn.Open();
                int effectedrows = await conn.ExecuteAsync(sQuery, new { Email = modelVerification.Email, VerificationCode = modelVerification.Code });

                _logger.LogDebug(effectedrows + " ef");
                if (effectedrows > 0)
                {
                    return(new Result
                    {
                        StatusCode = ResultCodes.Success,
                        Description = "Email has been verified"
                    });
                }
                else
                {
                    return(new Result
                    {
                        StatusCode = ResultCodes.AuthFail,
                        Description = "Verification fails"
                    });
                }
            }
            catch (Exception ex)
            {
                return(new Result
                {
                    StatusCode = ResultCodes.Error,
                    Description = "Verification fail"
                });
            }
        }
    }
Ejemplo n.º 2
0
 // [Route("dob/{dateOfBirth}")]
 public async Task <ActionResult <Result> > EmailVerify(ModelVerification verification)
 {
     return(await _credRepo.VerifyEmailAsync(verification));
 }