Exemplo n.º 1
0
        public IActionResult Index()
        {
            var model = new HomeViewModel
            {
                IsInBuy1Get1    = _promotionRepository.CheckPromotionBuy1Get1() ? 1 : 0,
                NotifyPopup     = _notifyPopupRepository.GetActiveNotifyPopup(),
                DrinkCategories = _categoryRepository.Categories.ToList()
            };

            return(View(model));
        }
Exemplo n.º 2
0
        public IViewComponentResult Invoke(DrinkCategory cat)
        {
            var isMobileTablet = _device.Type == DeviceType.Mobile || _device.Type == DeviceType.Tablet;
            var isOpen         = DateTime.Now.TimeOfDay > TimeSpan.FromHours(8) && DateTime.Now.TimeOfDay < TimeSpan.FromHours(17);
            var drinks         = cat.Id == 0 ? _drinkRepository.PreferredDrinks.ToList() : cat.Id == -1 ? _drinkRepository.NewDrinks.ToList(): _drinkRepository.DrinksByCategory(cat.Id).ToList();
            var notifyPopup    = _notifyPopupRepository.GetActiveNotifyPopup();

            ViewData["IsOpen"]         = isOpen;
            ViewData["NotifyPopup"]    = notifyPopup;
            ViewData["isMobileTablet"] = isMobileTablet;
            ViewData["cat"]            = cat;

            return(View(drinks));
        }