Beispiel #1
0
        public IActionResult ViewDetails(int id)
        {
            var monitor = _monitorRepository.GetMonitorById(id);

            if (monitor == null)
            {
                return(NotFound());
            }
            return(View(monitor));
        }
        public RedirectToActionResult AddToShoppingCart(int monitorId)
        {
            //_monitorRepository.Monitors = _monitorRepository.GetAllMonitors();

            var selectedMonitor = _monitorRepository.GetMonitorById(monitorId);

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

            return(RedirectToAction("Index"));
        }