public JsonResult RequestNewContent(int userId = 1) { var material = new AvailableMaterials(); var topicNames = material.GetTop3MaterialsForId(userId); const string msgFormat = "Your son needs a new topic select an option \n 1.{0} \n 2.{1} \n 3.{2}"; //TODO: Break down since for 130 chars if we are using the trial or 160 if not right now it only sends one message. var msg = String.Format(msgFormat, topicNames[0], topicNames[1], topicNames[2]); var response = SendSms(userId, msg); return(Json(response, JsonRequestBehavior.AllowGet)); }
public TwilioResponse ManageSms(SmsRequest request) { int controlNumber; string type; if (Int32.TryParse(request.Body, out controlNumber)) { switch (controlNumber) { case 1: case 2: case 3: var materials = new AvailableMaterials(); type = materials.GetTop3MaterialsForId(1)[controlNumber - 1]; break; default: throw new Exception("Response contained other characters that were not numbers"); break; } } else { //TODO:Handle This prettier throw new Exception("Response contained other characters that were not numbers"); } //TODO: Save The information of what type is and create and output for it. var blockBlob = CloudBlockBlob(); byte[] byteArray = Encoding.UTF8.GetBytes(type); using (var stream = new MemoryStream(byteArray)) { blockBlob.UploadFromStream(stream); } //System.IO.File.WriteAllText("holdData.txt", type); var re = new TwilioResponse(); re.Sms("Message Received"); return(re); }
public TwilioResponse ManageSms(SmsRequest request) { int controlNumber; string type; if (Int32.TryParse(request.Body, out controlNumber)) { switch (controlNumber) { case 1: case 2: case 3: var materials = new AvailableMaterials(); type = materials.GetTop3MaterialsForId(1)[controlNumber-1]; break; default: throw new Exception("Response contained other characters that were not numbers"); break; } } else { //TODO:Handle This prettier throw new Exception("Response contained other characters that were not numbers"); } //TODO: Save The information of what type is and create and output for it. var blockBlob = CloudBlockBlob(); byte[] byteArray = Encoding.UTF8.GetBytes(type); using (var stream = new MemoryStream(byteArray)) { blockBlob.UploadFromStream(stream); } //System.IO.File.WriteAllText("holdData.txt", type); var re = new TwilioResponse(); re.Sms("Message Received"); return re; }
public JsonResult RequestNewContent(int userId=1) { var material = new AvailableMaterials(); var topicNames = material.GetTop3MaterialsForId(userId); const string msgFormat = "Your son needs a new topic select an option \n 1.{0} \n 2.{1} \n 3.{2}"; //TODO: Break down since for 130 chars if we are using the trial or 160 if not right now it only sends one message. var msg = String.Format(msgFormat, topicNames[0], topicNames[1], topicNames[2]); var response = SendSms(userId, msg); return Json(response, JsonRequestBehavior.AllowGet); }