예제 #1
0
 // POST api/<controller>
 public List <SmsResource> Post([FromBody] SmsMessage value)
 {
     //Synchronize on messages so we don't have id collisions
     lock (messages)
     {
         SmsResource res = new SmsResource();
         res.message = value.message;
         res.to      = value.to;
         res.smsId   = currentId++;
         messages.Add(res.smsId, res);
         SentlyPlusSmsSender.SendMessage(value.to, value.message);
         return(Get());
     }
 }
 // POST api/<controller>
 public List<SmsResource> Post([FromBody] SmsMessage value)
 {
     //Synchronize on messages so we don't have id collisions
     lock (messages)
     {
         SmsResource res = new SmsResource();
         res.message = value.message;
         res.to = value.to;
         res.smsId = currentId++;
         messages.Add(res.smsId, res);
         SentlyPlusSmsSender.SendMessage(value.to, value.message);
         return Get();
     }
 }