Ejemplo n.º 1
0
        public ActionResult Index()
        {
            ViewModels.ShoppingCartViewModel cart = new ViewModels.ShoppingCartViewModel();
            cart.Albums = new List <string>();
            cart.Albums.Add("Album 1");
            cart.Albums.Add("Album 2");
            cart.Total = 10;

            return(View(cart));
        }
        //
        // GET: /ShoppingCart/
        public ActionResult Index()
        {
            var cart = Models.ShoppingCart.GetCart(this.HttpContext);

            // Set up our ViewModel
            var viewModel = new ViewModels.ShoppingCartViewModel
            {
                CartItems = cart.GetCartItems(),
                CartTotal = cart.GetTotal()
            };

            // Return the view
            return(View(viewModel));
        }
        //
        // GET: /ShoppingCart/


        public ActionResult Index()
        {
            shoppingCartLogic = ShoppingCartLogic.GetShoppingCart(this.HttpContext);

            var viewModel = new ViewModels.ShoppingCartViewModel();

            viewModel.CartItems  = shoppingCartLogic.GetShoppingCartItems().ToList();
            viewModel.TotalPrice = shoppingCartLogic.GetShoppingCartTotalPrice(viewModel.CartItems);

            ViewBag.ShowEdit = true;
            ViewBag.Title    = "購物車內容";

            return(View(viewModel));
        }
        //
        // GET: /ShoppingCart/
        public ActionResult Index()
        {
            shoppingCartLogic = ShoppingCartLogic.GetShoppingCart(this.HttpContext);

            var viewModel = new ViewModels.ShoppingCartViewModel ();

            viewModel.CartItems = shoppingCartLogic.GetShoppingCartItems().ToList();
               viewModel.TotalPrice = shoppingCartLogic.GetShoppingCartTotalPrice(viewModel.CartItems);

               ViewBag.ShowEdit = true;
               ViewBag.Title = "購物車內容";

            return View(viewModel);
        }