Exemplo n.º 1
0
        public HttpResponseMessage CreateOTPRegistraion(dynamic SearchForm)
        {
            try
            {
                string Email = string.Empty;
                Email = (string)SearchForm.Email;
                string OTPType = string.Empty;
                OTPType = (string)SearchForm.OTPType;
                UserClass CLE = new UserClass();
                DataTable dt  = new DataTable();
                dt = CLE.FN_CreateOTPRegistraion(Email, OTPType);
                string OTPCode = "";

                if (dt.Rows.Count > 0)
                {
                    OTPCode = dt.Rows[0]["OPTCode"].ToString();
                    string     Emails    = dt.Rows[0]["email"].ToString();
                    string     OTPtext   = "Use  below code to  " + OTPType + " your Account (The below otp is only for " + OTPType + " Account)";
                    ClassEmail OBJ       = new ClassEmail();
                    string     EmailText = OBJ.GetTemplate("otp.htm");
                    EmailText = EmailText.Replace("XXXOTPTypeXX", OTPtext).Replace("XXOTPXX", OTPCode);
                    try { OBJ.sendMail(Emails, "OTP code for registration", EmailText); } catch { }
                }

                return(Request.CreateResponse(HttpStatusCode.OK, OTPCode));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_Internal_Server_Error"));
            }
        }