Exemple #1
0
        // POST api/Sms
        public IHttpActionResult Post(SendSmsBindingModel model)
        {
            if (model == null)
            {
                return(BadRequest("no parameters"));
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var created = DateTime.UtcNow;
            var result  = new SmsMessage {
                Created = created, From = model.From, Message = model.Message, To = model.To
            };

            _repository.InsertThenQueue(result);
            return(Created(result.Guid.ToString(), result));
        }