예제 #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var cacheEntry = await _cache.GetOrCreateAsync(CacheKeys.FooterViewComponent, entry =>
            {
                entry.SlidingExpiration = TimeSpan.FromDays(1);
                var listFooters         = _footerService.GetAll().OrderBy(x => x.Order);
                var footer = new List <FooterDetails>();
                foreach (var item in listFooters)
                {
                    footer.Add(new FooterDetails()
                    {
                        FooterViewModel = item,
                        PageViewModels  = _footerService.GetAllPagesByFooterId(item.Id),
                    });
                }
                return(Task.FromResult(footer));
            });

            return(View(cacheEntry));
        }