Ejemplo n.º 1
0
        public ActionResult AddToCart(PerformanceVM model)
        {
            var    mediator = new TicketMediator();
            CartVM cart     = mediator.GetCart();

            cart.Performances.Add(model);
            return(Redirect("/Checkout/Cart"));
        }
Ejemplo n.º 2
0
        public ActionResult Review()
        {
            var    mediator = new TicketMediator();
            CartVM cart     = mediator.GetCart();

            if (cart.Performances == null || cart.Performances.Count == 0)
            {
                return(Redirect("/checkout/cart"));
            }
            var model = new PaymentVM();

            model.SameAsBilling = true;
            return(View("~/Views/Checkout/Review.cshtml", model));
        }
Ejemplo n.º 3
0
        public ActionResult Remove(PerformanceVM perf)
        {
            var mediator = new TicketMediator();
            var cart     = mediator.GetCart();

            cart.Performances.RemoveAt(perf.LineNumber);

            int i = 0;

            foreach (var performance in cart.Performances)
            {
                perf.LineNumber = i;
                i++;
            }
            return(Redirect("/checkout/cart"));
        }
Ejemplo n.º 4
0
        public ActionResult Confirmation()
        {
            var    mediator = new TicketMediator();
            CartVM cart     = mediator.GetCart();

            mediator.ClearCart();

            decimal total = 0;

            foreach (var perf in cart.Performances)
            {
                total += (perf.Quantity * perf.Price);
            }
            cart.Total = total;
            return(View(cart));
        }
Ejemplo n.º 5
0
        public ActionResult Cart()
        {
            var     mediator = new TicketMediator();
            CartVM  model    = mediator.GetCart();
            int     i        = 0;
            decimal total    = 0;

            foreach (var perf in model.Performances)
            {
                perf.LineNumber = i;
                i++;
                total += (perf.Quantity * perf.Price);
            }
            model.Total = total;

            return(View(model));
        }