public async Task <ActionResult> BlogList(string blogshortName) { var dto = await _blogAppService.GetByShortNameAsync(blogshortName); if (dto == null) { return(RedirectToAction("E404", "Error")); } // var postDtos = await _postAppService.GetListByBlogIdAndTagName(dto.Id, null); return(View()); }
public async Task OnGetAsync() { HeaderTitle = L("HomePage"); #region 文章列表 Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); if (Blog == null) { var listBlog = await _blogManager.QueryBlogsAsNoTracking().ToListAsync(); if (listBlog.Count > 0) { Blog = ObjectMapper.Map <BlogListDto>(listBlog[0]); } } 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 }); // PostsAndPopularTags.PostDetailsDtos = posts; PostsAndPopularTags.TagList = 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()); }
public async void OnGet() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetByTitleAsync(new GetPostInput { BlogId = blog.Id, Title = PostTitle }); Blog = blog; }
public async Task OnGetAsync() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = (await _postAppService.GetListByBlogId(blog.Id)).Items; PopularTags = (await _tagAppService.GetPopularTags(new GetPopularTagsInput { ResultCount = 10 })); }
public async Task Should_Get_Blog_By_Shortname() { var targetBlog = (await _blogAppService.GetListAsync()).Items.First(); var blog = await _blogAppService.GetByShortNameAsync(targetBlog.ShortName); blog.ShouldNotBeNull(); blog.Name.ShouldBe(targetBlog.Name); }
public async Task OnGetAsync() { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items; PopularTags = (await _tagAppService.GetPopularTags(new GetPopularTagsInput { ResultCount = 10, MinimumPostCount = 2 })); }
public virtual async Task <ActionResult> OnGetAsync() { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items; PopularTags = (await _tagAppService.GetPopularTags(Blog.Id, new GetPopularTagsInput { ResultCount = 10, MinimumPostCount = 2 })); return(Page()); }
public async void OnGet() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = new CreatePostDto() { BlogId = blog.Id }; Blog = blog; }
public virtual async Task <ActionResult> OnGetAsync() { if (BlogNameControlHelper.IsProhibitedFileFormatName(BlogShortName)) { return(NotFound()); } Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = (await _postAppService.GetListByBlogIdAndTagName(Blog.Id, TagName)).Items; PopularTags = (await _tagAppService.GetPopularTags(Blog.Id, new GetPopularTagsInput { ResultCount = 10, MinimumPostCount = 2 })); return(Page()); }
public async Task <IViewComponentResult> InvokeAsync(GetBlogRelatedInput input) { var blog = await _blogAppService.GetByShortNameAsync(input.BlogShortName); var postsViews = await _postAppService.GetMostViewsListByBlogId(blog.Id); var blogRelatedCategory = new BlogRelatedCategoryDto(); blogRelatedCategory.BlogShortName = blog.ShortName; blogRelatedCategory.postsDto = postsViews; return(View(blogRelatedCategory)); }
public async Task <IActionResult> OnGet() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); if (blog == null) { return(RedirectToAction("E404", "Error")); } PostDetailsDto = await _postAppService.GetForReadingAsync(new GetReadPostInput { BlogId = blog.Id, Url = Posturl }); if (PostDetailsDto == null) { return(RedirectToAction("E404", "Error")); } return(Page()); }
public async Task OnGetAsync() { var blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Posts = _postAppService.GetListByBlogIdAsync(blog.Id).Items; }
public async Task <BlogDto> GetByShortNameAsync(string shortName) { return(await _blogAppService.GetByShortNameAsync(shortName)); }
public async void OnGet() { Blog = await _blogAppService.GetByShortNameAsync(BlogShortName); Post = await _postAppService.GetByUrlAsync(new GetPostInput { BlogId = Blog.Id, Url = PostUrl }); }