예제 #1
0
        internal string SendOtp(OtpModel objReq)
        {

            Random generator = new Random();
            String r = generator.Next(10000, 1000000).ToString();

            using (var db= new WizzDataContext())
            {

                var userObj = db.tblUsers.Where(x => x.pkUserId == Convert.ToInt64(objReq.userId)).FirstOrDefault();
               
                userObj.phoneNum = objReq.phoneNum;
                userObj.isOtpVerified = false;
                twiliorest objTwillio = new twiliorest();
                string msg = "Welcome to Wizz tutors your Otp validation code is " + r;
                if (objTwillio.SendTeilioMessage(objReq.phoneNum, msg))
                {
                    db.SubmitChanges();
                }
                else {

                 
                }

                return r;    
                
                
            }
           
        }
예제 #2
0
        internal string SendOtp(OtpModel objReq)
        {

            Random generator = new Random();
            String r = generator.Next(10000, 1000000).ToString();
            r = r.Substring(0, 5);
            using (var db = new WizzDataContext())
            {
                if (db.tblUsers.Any(x => x.phoneNum.ToLower().Trim() == objReq.phoneNum.ToLower().Trim() && x.isOtpVerified == true && x.pkUserId != Convert.ToInt64(objReq.userId)))
                {
                    return "4";
                }

                var userObj = db.tblUsers.Where(x => x.pkUserId == Convert.ToInt64(objReq.userId)).FirstOrDefault();

                userObj.phoneNum = objReq.phoneNum;
                userObj.isOtpVerified = false;
                userObj.otpCode = r;
                twiliorest objTwillio = new twiliorest();
                string msg = "Welcome to Wizz Tutors your Otp validation code is " + r;
                db.SubmitChanges();
                if (objTwillio.SendTeilioMessage(objReq.phoneNum, msg))
                {

                }
                else
                {


                }

                return r;


            }

        }