diff --git a/guides/voice/gather-dtmf-tones-guide/gather-example-step-0/example.5.x.cs b/guides/voice/gather-dtmf-tones-guide/gather-example-step-0/example.5.x.cs index 260a557a0c..6f81ff4633 100644 --- a/guides/voice/gather-dtmf-tones-guide/gather-example-step-0/example.5.x.cs +++ b/guides/voice/gather-dtmf-tones-guide/gather-example-step-0/example.5.x.cs @@ -3,20 +3,22 @@ using System.Web.Mvc; using Twilio.AspNet.Mvc; +using Twilio.AspNet.Common; using Twilio.TwiML; +using System; public class VoiceController : TwilioController { [HttpPost] - public ActionResult Index() + public TwiMLResult Index() { var response = new VoiceResponse(); // Use the verb to collect user input - response.Gather(new Gather(numDigits: 1) - .Say("For sales, press 1. For support, press 2.")); + response.Gather(numDigits: 1) + .Say("For sales, press 1. For support, press 2."); // If the user doesn't enter input, loop - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); return TwiML(response); } diff --git a/guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs b/guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs index e7164cd724..18637e1833 100644 --- a/guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs +++ b/guides/voice/gather-dtmf-tones-guide/gather-example-step-1/example.5.x.cs @@ -3,18 +3,20 @@ using System.Web.Mvc; using Twilio.AspNet.Mvc; +using Twilio.AspNet.Common; using Twilio.TwiML; +using System; public class VoiceController : TwilioController { [HttpPost] - public ActionResult Index(string digits) + public TwiMLResult Index(VoiceRequest request) { var response = new VoiceResponse(); - if (!string.IsNullOrEmpty(digits)) + if (!string.IsNullOrEmpty(request.Digits)) { - switch (digits) + switch (request.Digits) { case "1": response.Say("You selected sales. Good for you!"); @@ -39,11 +41,10 @@ public ActionResult Index(string digits) private static void RenderMainMenu(VoiceResponse response) { - response.Gather( - new Gather(numDigits: 1) - .Say("For sales, press 1. For support, press 2.")); + response.Gather(numDigits: 1) + .Say("For sales, press 1. For support, press 2."); // If the user doesn't enter input, loop - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); } } diff --git a/guides/voice/gather-dtmf-tones-guide/gather-example-step-2.1/example.5.x.cs b/guides/voice/gather-dtmf-tones-guide/gather-example-step-2.1/example.5.x.cs index 47af9bc35a..13b8109cca 100644 --- a/guides/voice/gather-dtmf-tones-guide/gather-example-step-2.1/example.5.x.cs +++ b/guides/voice/gather-dtmf-tones-guide/gather-example-step-2.1/example.5.x.cs @@ -1,21 +1,24 @@ // In Package Manager, run: // Install-Package Twilio.AspNet.Mvc -DependencyVersion HighestMinor + using System.Web.Mvc; using Twilio.AspNet.Mvc; +using Twilio.AspNet.Common; using Twilio.TwiML; +using System; public class VoiceController : TwilioController { [HttpPost] - public ActionResult Gather(string digits) + public TwiMLResult Gather(VoiceRequest request) { var response = new VoiceResponse(); // If the user entered digits, process their request - if (!string.IsNullOrEmpty(digits)) + if (!string.IsNullOrEmpty(request.Digits)) { - switch (digits) + switch (request.Digits) { case "1": response.Say("You selected sales. Good for you!"); @@ -25,14 +28,14 @@ public ActionResult Gather(string digits) break; default: response.Say("Sorry, I don't understand that choice.").Pause(); - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); break; } } else { // If no input was sent, redirect to the /voice route - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); } return TwiML(response); diff --git a/guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.5.x.cs b/guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.5.x.cs index 7efebea8b9..5ba12594ac 100644 --- a/guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.5.x.cs +++ b/guides/voice/gather-dtmf-tones-guide/gather-example-step-2/example.5.x.cs @@ -3,34 +3,35 @@ using System.Web.Mvc; using Twilio.AspNet.Mvc; +using Twilio.AspNet.Common; using Twilio.TwiML; +using System; public class VoiceController : TwilioController { [HttpPost] - public ActionResult Index() + public TwiMLResult Index() { var response = new VoiceResponse(); - response.Gather( - new Gather(numDigits: 1, action: "/voice/gather") - .Say("For sales, press 1. For support, press 2.")); + response.Gather(numDigits: 1, action: new Uri("/voice/gather", UriKind.Relative)) + .Say("For sales, press 1. For support, press 2."); // If the user doesn't enter input, loop - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); - return Content(response.ToString(), "text/xml"); + return TwiML(response); } [HttpPost] - public ActionResult Gather(string digits) + public TwiMLResult Gather(VoiceRequest request) { var response = new VoiceResponse(); // If the user entered digits, process their request - if (!string.IsNullOrEmpty(digits)) + if (!string.IsNullOrEmpty(request.Digits)) { - switch (digits) + switch (request.Digits) { case "1": response.Say("You selected sales. Good for you!"); @@ -40,14 +41,14 @@ public ActionResult Gather(string digits) break; default: response.Say("Sorry, I don't understand that choice.").Pause(); - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); break; } } else { // If no input was sent, redirect to the /voice route - response.Redirect("/voice"); + response.Redirect(new Uri("/voice", UriKind.Relative)); } return TwiML(response);