Пример #1
0
        public IViewComponentResult Invoke()
        {
            NavbarModels model = new NavbarModels();

            try
            {
                model.Navbar = _navbarService.GetAll().Where(i => i.isApproved == true).First();
            }
            catch (Exception)
            {
                model.Navbar = null;
            }
            try
            {
                model.Social = _socialService.GetAll().Where(i => i.isApproved == true).First();
            }
            catch (Exception)
            {
                model.Social = null;
            }
            try
            {
                model.Menu = _menuService.GetAllWithMenuType().Where(i => i.isApproved).ToList();
            }
            catch (Exception)
            {
                model.Menu = null;
            }

            return(View(model));
        }
Пример #2
0
        public IActionResult Index()
        {
            var model = _navbarService.GetAll();

            ViewBag.items = model.Where(i => i.isApproved == true).Count();
            if (ViewBag.items == 1)
            {
                ViewBag.alert = false;
            }
            else
            {
                ViewBag.alert = true;
            }
            return(View(model));
        }