public HttpResponseMessage VerifyEmail(EmailVerificationRequestModel requestModel) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid Request"); } var name = HttpContext.Current.Request.UserHostAddress.ToString(); requestModel = new EmailVerificationRequestModel { //EmailAddress = requestModel.EmailAddress, EmailAddress = "*****@*****.**", }; VerificationAction verifyActions = new VerificationAction(); EmailVerificationResponseModel responseModel = verifyActions.VerifyEmail(requestModel); if (responseModel.Error != null) { return Request.CreateErrorResponse(HttpStatusCode.OK, responseModel.Error); } return Request.CreateResponse(HttpStatusCode.OK, responseModel, "application/json"); }
public HttpResponseMessage VerifyOnToken(string TokenId) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid Request"); } VerificationAction verifyActions = new VerificationAction(); EmailValidationResponseModel responseModel = verifyActions.VerifyOnToken(TokenId); string result = ""; if (responseModel.Message != null) { string template = "@Model.Message!"; result = Engine.Razor.RunCompile(template, "MessageTemplateKey", null, new { Message = responseModel.Message }); } else { string template = "@Model.Error!"; result = Engine.Razor.RunCompile(template, "ErrorTemplateKey", null, new { Error = responseModel.Error }); } var response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new StringContent(result); response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("text/html"); return response; }
public HttpResponseMessage EmailVerificationStatus(int RequestId) { if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Invalid Request"); } VerificationAction verifyActions = new VerificationAction(); BaseResponseModel responseModel = verifyActions.EmailVerificationStatus(RequestId); if (responseModel.Error != null) { return Request.CreateErrorResponse(HttpStatusCode.OK, responseModel.IsValid.ToString()); } return Request.CreateResponse(HttpStatusCode.OK, responseModel, "application/json"); }