Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var itens = _carrinhoCompra.GetCarrinhoItens();

            _carrinhoCompra.CarrinhoCompraItems = itens;

            var carrinho = new CarrinhoViewModel
            {
                carrinhoCompra = _carrinhoCompra,
                CarrinhoTotal  = _carrinhoCompra.GetTotalCarrinho()
            };

            return(View(carrinho));
        }
Ejemplo n.º 2
0
        public IViewComponentResult Invoke()
        {
            var itens = _carrinhoCompra.GetCarrinhoItens();

            //var itens = new List<CarrinhoCompraItem>()
            //{
            //    new CarrinhoCompraItem(),
            //    new CarrinhoCompraItem()
            //};
            _carrinhoCompra.CarrinhoCompraItems = itens;

            var carinhoVM = new CarrinhoViewModel
            {
                carrinhoCompra = _carrinhoCompra,
                CarrinhoTotal  = _carrinhoCompra.GetTotalCarrinho()
            };

            return(View(carinhoVM));
        }