コード例 #1
0
        public TwiMLResult ConfirmQuantity(string qty, string digits)
        {
            var response = new VoiceResponse();

            if (digits != "1" && digits != "2")
            {
                response.Say("invalid choice", voice: "alice", language: "en-US");
                response.Redirect("/Sales/VerifyQuantity?digits=" + qty);
            }
            else if (digits == "2")
            {
                response.Redirect("/Sales/ChooseQuantity");
            }
            else
            {
                SalesRepository repo = new SalesRepository();
                repo.AddQuantityToOrderDetail(int.Parse(qty), (int)Session["orderDetailId"], (int)Session["orderId"]);
                response.Gather(new Gather(action: "/Sales/ConfirmOrderDetail", numDigits: 1)
                                .Say("To add another item press 1, to checkout press 2, to review and edit your order press 3", voice: "alice", language: "en-US"));
                response.Redirect("/Sales/ConfirmOrderDetail?digits=" + 99);
            }
            return(TwiML(response));
        }