예제 #1
0
 public MassMessageDTO HandleIncomingSms([FromBody]SmsDTO incomingSms)
 {
     var smsSender = incomingSms.Sender;
     var body = incomingSms.Body;
     var sms = incomingSms.SmsDTOToSms();
     context.Smses.Add(sms);
     context.SaveChanges();
     var res = processSms(sms);
     var mm = new MassMessageDTO
     {
         Numbers = new string[] { smsSender },
         Body = res
     };
     //Do not save the SMS'es
     //foreach (var item in mm.Numbers)
     //{
     //    context.SentSmses.Add(new SentSms
     //    {
     //        Body = mm.Body,
     //        Reciever = item,
     //        Sent = DateTime.Now
     //    });
     //}
     //context.SaveChanges();
     return mm;
 }
예제 #2
0
 public static MassMessageDTO ToMassMessageDTO(this PredefinedSms preSms, string[] numbers)
 {
     var mm = new MassMessageDTO
     {
         Body = preSms.Text,
         Numbers = numbers
     };
     return mm;
 }