Ejemplo n.º 1
0
        // GET: Default
        public ActionResult Index()
        {
            IShoppingCartManager shoppingCartManager = new ShoppingCartManager();

            List <Product> products = shoppingCartManager.GetAllProducts();

            List <ProductPiece> orderProducts = new List <ProductPiece>();

            orderProducts.Add(new ProductPiece()
            {
                Product = products.First(x => x.Id == 3), Piece = 1
            });
            orderProducts.Add(new ProductPiece()
            {
                Product = products.First(x => x.Id == 3), Piece = 1
            });

            orderProducts.Add(new ProductPiece()
            {
                Product = products.First(x => x.Id == 1), Piece = 2
            });
            orderProducts.Add(new ProductPiece()
            {
                Product = products.First(x => x.Id == 2), Piece = 1
            });


            ShoppingCartModel shoppingCart = shoppingCartManager.AddProductToCart(orderProducts);

            return(View(shoppingCart));
        }