public CarrinhoViewModel EditarItemCarrinho(CarrinhoViewModel carrinhoViewModel, ItemCarrinhoViewModel itemCarrinhoViewModel)
        {
            var carrinho = BindCarrinhoViewModelToCarrinho(carrinhoViewModel);
            var itemCarrinho = Mapper.Map<ItemCarrinhoViewModel, ItemCarrinho>(itemCarrinhoViewModel);

            var carrinhoResult = this.carrinhoService.EditarItemCarrinho(carrinho, itemCarrinho);

            return BindCarrinhoToCarrinhoViewModel(carrinhoResult);
        }
        public CarrinhoViewModel AdicionarItemNoCarrinho(CarrinhoViewModel carrinhoViewModel, ItemCarrinhoViewModel itemCarrinhoViewModel)
        {
            var carrinho = BindCarrinhoViewModelToCarrinho(carrinhoViewModel);
            var itemCarrinho = Mapper.Map<ItemCarrinhoViewModel, ItemCarrinho>(itemCarrinhoViewModel);

            carrinho = this.carrinhoService.AdicionarItemNoCarrinho(carrinho, itemCarrinho);

            return BindCarrinhoToCarrinhoViewModel(carrinho);
        }
        public ActionResult AddItem(ItemCarrinhoViewModel itemCarrinho)
        {
            CarrinhoViewModel carrinho = new CarrinhoViewModel();

            var carrinhoSession = Session["Carrinho"];

            if (carrinhoSession != null)
                carrinho = (CarrinhoViewModel)carrinhoSession;

            var carrinhoViewModel = this.carrinhoAppService.AdicionarItemNoCarrinho(carrinho, itemCarrinho);

            Session["Carrinho"] = carrinhoViewModel;

            return PartialView("_DetalheCarrinho", carrinhoViewModel);
        }
        public ActionResult EditarItem(ItemCarrinhoViewModel itemCarrinho)
        {
            var carrinhoSession = (CarrinhoViewModel)Session["Carrinho"];

            if (carrinhoSession == null)
                return PartialView("_DetalheCarrinho", new CarrinhoViewModel());

            carrinhoSession = this.carrinhoAppService.EditarItemCarrinho(carrinhoSession, itemCarrinho);

            if (carrinhoSession.ResultadoValidacao.IsValid)
                Session["Carrinho"] = carrinhoSession;

            carrinhoSession = (CarrinhoViewModel)Session["Carrinho"];

            return PartialView("_DetalheCarrinho", carrinhoSession);
        }
        public ActionResult ItemCarrinho(int? produtoId)
        {
            var itemCarrinho = new ItemCarrinhoViewModel();

            if (produtoId.HasValue)
                itemCarrinho.Produto = produtoAppService.SelecionarPorId(produtoId.Value);

            return PartialView("_ItemCarrinho", itemCarrinho);
        }