public IViewComponentResult Invoke() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); //var itens = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; //var itens = new List<CarrinhoCompraItem>(); //var item1 = new CarrinhoCompraItem(); //itens.Add(item1); //var item2 = new CarrinhoCompraItem(); //itens.Add(item2); //para testar //var items = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraVM)); }
public IActionResult Index() { _carrinhoCompra.Itens = _carrinhoCompra.GetItens(); var carrinhoCompra = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, Total = _carrinhoCompra.GetValorTotal() }; return(View(carrinhoCompra)); }
public IActionResult Index() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return View(carrinhoCompraViewModel); }
// // GET: /CarrinhoCompra/ public ActionResult Index() { var carrinho = CarrinhoCompra.ObterCarrinho(this.HttpContext); // Set up our ViewModel var viewModel = new CarrinhoCompraViewModel { CartItems = carrinho.ObterCarrinhoItens(), CarrinhoTotal = carrinho.ObterTotal() }; // Return the view return(View(viewModel)); }
//*********************************************************************************************************************************************************** //*********************************************************************************************************************************************************** //Exibe os itens adicionados no carrinho public IActionResult Index() { var itensDoCarrinho = _carrinhoCompra.ObterCarrinhoCompraItens(); _carrinhoCompra.ItensCarrinhoCompras = itensDoCarrinho; CarrinhoCompraViewModel carrinhoCompraViewModel = new CarrinhoCompraViewModel { carrinhoCompra = _carrinhoCompra, TotalCarrinho = _carrinhoCompra.ObterCarrinhoCompraTotal() }; return(View(carrinhoCompraViewModel)); }
public IActionResult Index() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = Convert.ToDecimal(_carrinhoCompra.GetCarrinhoCompraTotal()) }; return(View(carrinhoCompraVM)); }
public IActionResult Index() // exibe o carrinho com base na viewmodel { var itens = _carrinhoCompra.GetCarrinhoCompraItems(); _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraViewModel)); }
public IViewComponentResult Invoke() { var itens = _carrinhoCompra.GetCarrinhoCompraItems(); _carrinhoCompra.CarrinhoCompraItems = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View()); }
public IActionResult Index() { List <CarrinhoCompraItem> itens = _carrinhoCompra.GetCarrinhoCompraItens(); _carrinhoCompra.ListCarrinhoCompraItens = itens; CarrinhoCompraViewModel carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraViewModel)); }
public async Task <IActionResult> Index() { var usuario = await _userManager.GetUserAsync(HttpContext.User); var produtosAdicionados = await _carrinhoCompraRepository.GetItemsForUserById(usuario.Id); var carrinhoVm = new CarrinhoCompraViewModel { CarrinhoCompraList = produtosAdicionados, ValorTotalItems = _carrinhoCompraRepository.GetValorTotalDeItems(produtosAdicionados) }; return(View(carrinhoVm)); }
public IActionResult Index() { var itens = _carrinhoCompra.GetCarrinhoCompraItems(); _carrinhoCompra.CarrinhoCompraItems = itens; var carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, TotalCarrinho = _carrinhoCompra.GetCarrinhoTotalCompra() }; return(View(carrinhoCompraViewModel)); }
public IViewComponentResult Invoke() { var itens = _carrinhoCompra.GetCarrinhoCompraItems(); //var itens = new List<CarrinhoCompraItem>() {new CarrinhoCompraItem(), new CarrinhoCompraItem()}; _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVm = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraVm)); }
public IActionResult Index() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; // vai exibir o carrinho de compras com base na ViewModel return(View(carrinhoCompraViewModel)); }
//Esse método Action exibe o carrinho de compras com base na minha ViewModel public IActionResult Index() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoDeCompraViewModel = new CarrinhoCompraViewModel { //ter acesso as propriedades do carrinho de compra CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoDeCompraViewModel)); }
public IViewComponentResult Invoke() { //_carrinhoCompra.Itens = _carrinhoCompra.GetItens(); _carrinhoCompra.Itens = new List <CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; var carrinhoCompraViewModel = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, Total = _carrinhoCompra.GetValorTotal() }; return(View(carrinhoCompraViewModel)); }
public IViewComponentResult Invoke() { var items = _carrinhoCompra.GetCarrinhoCompraItens(); //para testar //var items = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; _carrinhoCompra.CarrinhoCompraItens = items; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = Convert.ToDecimal(_carrinhoCompra.GetCarrinhoCompraTotal()) }; return(View(carrinhoCompraVM)); }
public IViewComponentResult Invoke() { var itens = _carrinhoCompra.GetCarrinhoCompraItens(); //var itens = new System.Collections.Generic.List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem()}; _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return View(carrinhoCompraVM); }
public async Task <IActionResult> ItensCarrinhoResumo() { Usuario usuario = await _userManager.GetUserAsync(HttpContext.User); var carrinhoVm = new CarrinhoCompraViewModel(); if (usuario != null) { var produtosAdicionados = await _carrinhoCompraRepository.GetItemsForUserById(usuario.Id); carrinhoVm.CarrinhoCompraList = produtosAdicionados; carrinhoVm.ValorTotalItems = _carrinhoCompraRepository.GetValorTotalDeItems(produtosAdicionados); } return(Json(carrinhoVm)); }
public IViewComponentResult Invoke() { var itens = _carrinhoCompra.GetCarrinhoCompraItems();// obter itens do carrinho //var itens = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraVM)); // retorna o carrinho e o total do carrinho }
public IViewComponentResult Invoke() { // obter itens do carrinho var itens = _carrinhoCompra.GetCarrinhoCompraItens(); /* var itens = new List<CarrinhoCompraItem>() { new CarrinhoCompraItem(), new CarrinhoCompraItem() }; */ _carrinhoCompra.CarrinhoCompraItens = itens; var carrinhoCompraVM = new CarrinhoCompraViewModel { CarrinhoCompra = _carrinhoCompra, CarrinhoCompraTotal = _carrinhoCompra.GetCarrinhoCompraTotal() }; return(View(carrinhoCompraVM)); }
public IViewComponentResult Invoke() { try { var carrinhoVM = new CarrinhoCompraViewModel(); if (User.Identity.IsAuthenticated) { Usuario usuario = _userManager.GetUserAsync(HttpContext.User).Result; var carrinhoComprasForUser = _carrinhoRepository.GetItemsForUserById(usuario.Id).Result; carrinhoVM.CarrinhoCompraList = carrinhoComprasForUser; carrinhoVM.TotalItems = carrinhoComprasForUser.Count; return(View(carrinhoVM)); } return(View(carrinhoVM)); } catch (Exception) { return(View()); } }