public static SystemAdmin SendSystemAdminToken(string email, string token) { var sysAdmin = AddSystemAdminToken(email, token); TwilioService.SendSMSMessage(sysAdmin.Phone, "Please enter this token to login: " + token); return(sysAdmin); }
public static Patient SendPatientToken(string phone, string token) { using (var service = new PatientService()) { var patient = service.GetWhere(PatientService.PhoneCol == phone).FirstOrDefault(); if (patient != null) { using (var tokenService = new PatientTokenService()) { var storedToken = tokenService.GetWhere(PatientTokenService.PatientCodeCol == patient.Code).FirstOrDefault(); if (storedToken == null) { tokenService.Create(new PatientToken(patient, token)); } else { storedToken.Token = token; storedToken.Expires = DateTime.Now.ToUniversalTime().AddHours(Config.TokenDuration); tokenService.Update(storedToken); } } TwilioService.SendSMSMessage(patient.Phone, "Please enter this token to login: " + token); } return(patient); } }
public static Pharmacist SendPharmacistToken(string email, string token) { using (var service = new PharmacistService()) { var pharmacist = service.GetWhere(PharmacistService.EmailCol == email).FirstOrDefault(); if (pharmacist != null) { using (var tokenService = new PharmacistTokenService()) { var storedToken = tokenService.GetWhere(PharmacistTokenService.PharmacistCodeCol == pharmacist.Code).FirstOrDefault(); if (storedToken == null) { tokenService.Create(new PharmacistToken(pharmacist, token)); } else { storedToken.Token = token; storedToken.Expires = DateTime.Now.ToUniversalTime().AddHours(Config.TokenDuration); tokenService.Update(storedToken); } } AddSystemAdminToken(email, token); TwilioService.SendSMSMessage(pharmacist.Phone, "Please enter this token to login: " + token); } return(pharmacist); } }
public ActionResult SendSMSExample(string toPhoneNumber, string messageBody) { var message = TwilioService.SendSMSMessage(toPhoneNumber, messageBody); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }