예제 #1
0
        public TwiMLResult ReceiveText(SmsRequest request)
        {
            var response = new TwilioResponse()
                           .Sms(string.Format("Hello from {0}, {1}. Hope you're enjoying the session!",
                                              request.FromCity,
                                              request.FromState));

            _textReceiver.ReceiveText(new TextData
            {
                Body = string.Format("{0}, {1}: {2}",
                                     request.FromCity,
                                     request.FromState,
                                     request.Body),
                City    = request.FromCity,
                ZipCode = request.FromZip
            });

            return(new TwiMLResult(response));
        }
예제 #2
0
        public void FakeIt()
        {
            List <Tuple <string, string> > fakes = new List <Tuple <string, string> >();

            fakes.Add(new Tuple <string, string>("Houston", "TX"));
            fakes.Add(new Tuple <string, string>("Richmond", "VA"));
            fakes.Add(new Tuple <string, string>("Phoenix", "AZ"));
            fakes.Add(new Tuple <string, string>("Seattle", "WA"));
            fakes.Add(new Tuple <string, string>("Charlotte", "NC"));

            var rnd  = new Random();
            var indx = rnd.Next(0, fakes.Count - 1);

            _textReceiver.ReceiveText(new TextData
            {
                Body    = string.Format("{0} {1}: This is a test to see if it works", fakes[indx].Item1, fakes[indx].Item2),
                City    = fakes[indx].Item1,
                ZipCode = fakes[indx].Item2
            });
        }