Exemplo n.º 1
0
        public IViewComponentResult Invoke()
        {
            var items = _shopingCardRepo.GetShopingCards();

            _shopingCardRepo.ShopingCards = items;

            var shopingCardViewModel = new ShopingCardViewModel
            {
                ShopingCard      = _shopingCardRepo,
                ShopingCardTotal = _shopingCardRepo.GetTotalShopingCards()
            };

            return(View(shopingCardViewModel));
        }
Exemplo n.º 2
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var items = _shopingRepo.GetShopingCards();

            _shopingRepo.ShopingCards = items;

            var shopingCardViewModel = new ShopingCardViewModel
            {
                ShopingCard      = _shopingRepo,
                ShopingCardTotal = _shopingRepo.GetTotalShopingCards()
            };

            return(View(shopingCardViewModel));
        }
Exemplo n.º 3
0
        public IActionResult ShopingCard()
        {
            string userId = this.userManager.GetUserId(HttpContext.User);

            var shopingCardId = this.shopinCardService.FindShopigCardId(userId);

            if (shopingCardId == 0)
            {
                shopingCardId = this.shopinCardService.CreateShopingCard(userId);
            }

            var model = new ShopingCardViewModel()
            {
                CardProduct = this.shopinCardService.ShowShopingCard(shopingCardId)
            };

            return(View(model));
        }