Example #1
0
        public async Task <IViewComponentResult> InvokeAsync()
        {
            var tagsList = await Task.FromResult(_tagsManager.GetQueryable());

            var models = new List <TagsViewModel>();

            foreach (var item in tagsList)
            {
                models.Add(new TagsViewModel()
                {
                    Name  = item.Name,
                    Count = await _tagsManager.GetPostsCountAsync(item.Id),
                });
            }

            return(View(models));
        }