Пример #1
0
        public ActionResult Sms(SmsRequest request)
        {
            var response = new TwilioResponse();

            string[] validNumbers = new string[] { "+18508032974", "+13237071329" };

            if (!validNumbers.Contains<string>(request.From))
            {
                response.Sms("Hi, I'm not allowed to talk to strangers. Please visit http://dareme.to.");
                return new TwiMLResult(response);
            }

            string[] parsed=request.Body.Split(new char[] { ' ' });
            if (parsed==null || parsed.Length < 2)
            {
                response.Sms("That's not a valid command. :-/");
                return new TwiMLResult(response);
            }

            DareManager dareMgr = new DareManager();

            switch (parsed[0].ToUpper())
            {
                case "MOD":
                    dareMgr.Takedown(Convert.ToInt64(parsed[1]));
                    break;
                default:
                    response.Sms("That's not a valid command. :-\\");
                    break;
            }

            return new TwiMLResult(response);
        }
Пример #2
0
 public void Takedown(long id)
 {
     DareManager dareMgr = new DareManager();
     dareMgr.Takedown(id);
     dareMgr = null;
 }