public async Task <IViewComponentResult> InvokeAsync(PostsAndPopularTags postsAndPopularTags) { await Task.Yield(); return(View(postsAndPopularTags)); }
protected override async Task OnInitializedAsync() { #region 文章列表 var blog = await _blogAppService.GetByShortNameAsync(blogShortName).ConfigureAwait(false); if (blog == null) { var listBlog = await _blogManager.QueryBlogsAsNoTracking().ToListAsync(); if (listBlog.Count > 0) { blog = ObjectMapper.Map <BlogListDto>(listBlog[0]); } } PostsAndTags = new PostsAndPopularTags { BlogShortName = blog.ShortName }; //var posts = (await _postAppService.GetListByBlogIdAndTagName(blog.Id, tagName).ConfigureAwait(false)).Items; var popularTags = await _tagAppService.GetPopularTags(new GetPopularTagsInput { BlogId = blog.Id, ResultCount = 10, MinimumPostCount = 2 }).ConfigureAwait(false); // PostsAndTags.posts = posts; PostsAndTags.tags = popularTags; #endregion }
public async Task <ActionResult> Index(string blogShortName, string tagName = null) { #region 文章列表 var blog = await _blogAppService.GetByShortNameAsync(blogShortName); if (blog == null) { var listBlog = await _blogManager.QueryBlogsAsNoTracking().ToListAsync(); if (listBlog.Count > 0) { blog = ObjectMapper.Map <BlogListDto>(listBlog[0]); } } var viewModel = new PostsAndPopularTags { BlogShortName = blog.ShortName }; //var posts = (await _postAppService.GetListByBlogIdAndTagName(blog.Id, tagName)).Items; //var popularTags = await _tagAppService.GetPopularTags(new GetPopularTagsInput { BlogId = blog.Id, ResultCount = 10, MinimumPostCount = 2 }); //viewModel.PostDetailsDtos = posts; //viewModel.TagList = popularTags; //ViewBag.postsList = viewModel; #endregion 文章列表 return(View()); }