public RedirectToActionResult AddToShoppingCart(int candyId)
        {
            var selectedCandy = _candyRepository.GetCandyById(candyId);

            if (selectedCandy != null)
            {
                _shoppingCart.AddToCart(selectedCandy, 1);
            }

            return(RedirectToAction("Index"));
        }
Esempio n. 2
0
        public IActionResult Details(int id)
        {
            var candy = _candyRepository.GetCandyById(id);

            if (candy == null)
            {
                return(NotFound());
            }
            return(View(candy));
        }