protected async Task <bool> CreateViewBag() { ViewBag.Categories = await db.Categories.ToListAsync(); ViewBag.Projects = await db.Projects.ToListAsync(); ViewBag.Pages = await db.Pages.OrderBy(p => p.Weight).ToListAsync(); ViewBag.Slides = await db.Slides.ToListAsync(); ViewBag.Essentials = await db.Essentials.FirstOrDefaultAsync(); if (Cart == null) { Cart = CartViewModel.GetInstance(HttpContext); } return(true); }
/// <summary> /// The invoke. /// </summary> /// <returns> /// The <see cref="IViewComponentResult"/>. /// </returns> public IViewComponentResult Invoke() { Cart = CartViewModel.GetInstance(HttpContext); return(this.View("~/Views/Shared/_CartIcon.cshtml", Cart)); }