コード例 #1
0
        public GenericTestResult RequestVerificationCode(string emailAddress)
        {
            GenericTestResult httpResponse = new GenericTestResult();

            httpResponse.Date = DateTime.Now;
            int statusCode = (int)HttpStatusCode.OK;

            httpResponse.Operation = "Client request for a verifaction code.";
            if (!GenericHelpers.IsEmailAddressValid(emailAddress))
            {
                httpResponse.Message = "Illegal email address: " + emailAddress;
            }
            else
            {
                bool test = SessionHelpers.RequestVerificationCode(emailAddress);
                if (!test)
                {
                    statusCode           = (int)HttpStatusCode.InternalServerError;
                    httpResponse.Message = "Something bad happened...";
                }
                else
                {
                    httpResponse.Message = "Ok";
                }
                httpResponse.BoolResult = test;
            }
            this.HttpContext.Response.StatusCode = statusCode;
            httpResponse.StatusCode = statusCode;
            return(httpResponse);
        }
コード例 #2
0
 public string TestSendgrid(string receiver)
 {
     if (!GenericHelpers.IsEmailAddressValid(receiver))
     {
         return(("Illegal email address: " + receiver).ToString());
     }
     SendgridHelpers.TestSend(receiver);
     return(("Sent to " + receiver).ToString());
 }