public FetchUsers FetchData(string deviceid) { try { AlexaWakeUp_Result alexaWakeUp = alexaDBEntity.AlexaWakeUp(deviceid).FirstOrDefault(); FetchUsers users = new FetchUsers(); if (alexaWakeUp != null) { users.name = alexaWakeUp.Titleprefix + " " + alexaWakeUp.UsrP_FirstName + " " + alexaWakeUp.UsrP_LastName; users.mobileNumber = alexaWakeUp.Usrp_MobileNumber; users.status = 1; var otp = GenerateRandomNo(); //Updating the Otp var userProfile = alexaDBEntity.UsersProfiles.Where(x => x.Usrp_MobileNumber == users.mobileNumber).FirstOrDefault(); userProfile.passcode = otp; alexaDBEntity.SaveChanges(); //Sending Otp via Text Message var message = "Otp : " + otp; var client = new RestClient("http://msg.msgclub.net/rest/services/sendSMS/sendGroupSms?AUTH_KEY=a39d36115c841484ea31ddc31936ee4&message=" + message + "&senderId=SIGNUP&routeId=8&mobileNos=" + users.mobileNumber + "&smsContentType=english"); var request = new RestRequest(Method.GET); request.AddHeader("Cache-Control", "no-cache"); IRestResponse response = client.Execute(request); } else { users.status = 0; } return(users); } catch (Exception ex) { throw ex; } }
public FetchUsers FetchUserDetails(string deviceid) { FetchUsers users = new FetchUsers(); try { AlexaWakeUp_Result alexaWakeUp = alexaDBEntity.AlexaWakeUp(deviceid).FirstOrDefault(); users.name = alexaWakeUp.Titleprefix + " " + alexaWakeUp.UsrP_FirstName + " " + alexaWakeUp.UsrP_LastName; users.mobileNumber = alexaWakeUp.Usrp_MobileNumber; users.status = 1; } catch (Exception ex) { throw ex; } return(users); }