public HttpResponseMessage CreateOTP(dynamic SearchForm) { try { string RegID = string.Empty; RegID = (string)SearchForm.RegID; string OTPType = string.Empty; OTPType = (string)SearchForm.OTPType; UserClass CLE = new UserClass(); DataTable dt = new DataTable(); dt = CLE.Fn_CreateOTP(RegID, 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 " + OTPType, EmailText); } catch { } } return(Request.CreateResponse(HttpStatusCode.OK, OTPCode)); } catch (Exception ex) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500_Internal_Server_Error")); } }