예제 #1
0
        public TwiMLResult ReviewSize1(string digits)
        {
            var response          = new VoiceResponse();
            ReviewRepository repo = new ReviewRepository();
            Size             size = repo.FindSizeBySizeCodeForProduct(digits, (int)Session["OrderDetailID"]);

            if (!repo.DoesSizeExist(digits))
            {
                response.Say("invalid size code, please try again", voice: "alice", language: "en-US");
                response.Redirect("/Review/EditSize1");
            }
            else if (size == null)
            {
                response.Say("Product not available in this size, please try again", voice: "alice", language: "en-US");
                response.Redirect("/Review/EditSize1");
            }
            else if (repo.DoesItemExistInOrder(digits, (int)Session["OrderDetailID"]))
            {
                response.Say("you already have this item in size " + size.Size1 + " in your order, to make changes to that item find it from the review menu "
                             + " and edit it.", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else if (repo.OutOfStock((int)Session["OrderDetailID"], 0, size.SizeID))
            {
                response.Say("I'm sorry but you can't change the size of this item, since there is not enough stock in the size you chose", voice: "alice", language: "en-US");
                response.Redirect("/Review/ReviewOptions");
            }
            else
            {
                response.Gather(new Gather(action: "/Review/ConfirmSize1?sizeId=" + size.SizeID + "&sizeCode=" + size.SizeCode, numDigits: 1)
                                .Say("you have chosen to update the size to, " + size.Size1 + " , to enter the size again, press 1. to confirm press 2.", voice: "alice", language: "en-US"));
                response.Redirect("/Review/ReviewSize1?digits=" + digits);
            }
            return(TwiML(response));
        }