Exemplo n.º 1
0
        public HttpResponseMessage PostReply(TwiML message)
        {
            string responseText = "La requête n'est pas correcte !";

            var parts = message.Body.ToLower().Split(' ');

            if (parts[0] == "oui")
            {
                var shortcode = parts[1];

                using (ApplicationDbContext context = new ApplicationDbContext())
                {
                    var activity = context
                                   .Activities.Include(a => a.UserActivities)
                                   .Include("UserActivities.User")
                                   .FirstOrDefault(a => a.ShortCode == shortcode);

                    if (activity != null)
                    {
                        var user = context.Users.FirstOrDefault(u => u.PhoneNumber == message.From);
                        if (user != null)
                        {
                            activity.Driver = user;
                            context.SaveChanges();

                            var smsService = new SmsActivityNotificationService();
                            smsService.SendDriverConfirmation(activity);

                            responseText = "Merci !";
                        }
                    }
                }
            }

            HttpResponseMessage response = new HttpResponseMessage()
            {
                Content = new StringContent(
                    responseText,
                    Encoding.UTF8,
                    "plain/text")
            };

            return(response);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Identity Append(TwiML childElem)
 {
     return((Identity)base.Append(childElem));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Dial Append(TwiML childElem)
 {
     return((Dial)base.Append(childElem));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Play Append(TwiML childElem)
 {
     return((Play)base.Append(childElem));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Start Append(TwiML childElem)
 {
     return((Start)base.Append(childElem));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Gather Append(TwiML childElem)
 {
     return((Gather)base.Append(childElem));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Task Append(TwiML childElem)
 {
     return((Task)base.Append(childElem));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Connect Append(TwiML childElem)
 {
     return((Connect)base.Append(childElem));
 }
Exemplo n.º 9
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Refer Append(TwiML childElem)
 {
     return((Refer)base.Append(childElem));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Number Append(TwiML childElem)
 {
     return((Number)base.Append(childElem));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Sms Append(TwiML childElem)
 {
     return((Sms)base.Append(childElem));
 }
Exemplo n.º 12
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Stop Append(TwiML childElem)
 {
     return((Stop)base.Append(childElem));
 }
Exemplo n.º 13
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Autopilot Append(TwiML childElem)
 {
     return((Autopilot)base.Append(childElem));
 }
Exemplo n.º 14
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Room Append(TwiML childElem)
 {
     return((Room)base.Append(childElem));
 }
Exemplo n.º 15
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new SsmlProsody Append(TwiML childElem)
 {
     return((SsmlProsody)base.Append(childElem));
 }
Exemplo n.º 16
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Conference Append(TwiML childElem)
 {
     return((Conference)base.Append(childElem));
 }
Exemplo n.º 17
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Client Append(TwiML childElem)
 {
     return((Client)base.Append(childElem));
 }
Exemplo n.º 18
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new SsmlS Append(TwiML childElem)
 {
     return((SsmlS)base.Append(childElem));
 }
Exemplo n.º 19
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Message Append(TwiML childElem)
 {
     return((Message)base.Append(childElem));
 }
Exemplo n.º 20
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Prompt Append(TwiML childElem)
 {
     return((Prompt)base.Append(childElem));
 }
Exemplo n.º 21
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Enqueue Append(TwiML childElem)
 {
     return((Enqueue)base.Append(childElem));
 }
Exemplo n.º 22
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Media Append(TwiML childElem)
 {
     return((Media)base.Append(childElem));
 }
Exemplo n.º 23
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Redirect Append(TwiML childElem)
 {
     return((Redirect)base.Append(childElem));
 }
Exemplo n.º 24
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new SsmlBreak Append(TwiML childElem)
 {
     return((SsmlBreak)base.Append(childElem));
 }
Exemplo n.º 25
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Stream Append(TwiML childElem)
 {
     return((Stream)base.Append(childElem));
 }
Exemplo n.º 26
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Siprec Append(TwiML childElem)
 {
     return((Siprec)base.Append(childElem));
 }
Exemplo n.º 27
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Record Append(TwiML childElem)
 {
     return((Record)base.Append(childElem));
 }
Exemplo n.º 28
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new Pause Append(TwiML childElem)
 {
     return((Pause)base.Append(childElem));
 }
Exemplo n.º 29
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new SsmlEmphasis Append(TwiML childElem)
 {
     return((SsmlEmphasis)base.Append(childElem));
 }
Exemplo n.º 30
0
 /// <summary>
 /// Append a child TwiML element to this element returning this element to allow chaining.
 /// </summary>
 /// <param name="childElem"> Child TwiML element to add </param>
 public new SsmlPhoneme Append(TwiML childElem)
 {
     return((SsmlPhoneme)base.Append(childElem));
 }