Browse Source

Get it before filtering the post tag.

pull/859/head
maliming 8 years ago
parent
commit
23a86a10ec
  1. 10
      modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs

10
modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs

@ -36,19 +36,19 @@ namespace Volo.Blogging.Posts
var userDictionary = new Dictionary<Guid, BlogUserDto>();
var postDtos = new List<PostWithDetailsDto>(ObjectMapper.Map<List<Post>, List<PostWithDetailsDto>>(posts));
if (tag != null)
foreach (var postDto in postDtos)
{
postDtos = await FilterPostsByTag(postDtos, tag);
postDto.Tags = await GetTagsOfPost(postDto.Id);
}
foreach (var postDto in postDtos)
if (tag != null)
{
postDto.CommentCount = await _commentRepository.GetCommentCountOfPostAsync(postDto.Id);
postDtos = await FilterPostsByTag(postDtos, tag);
}
foreach (var postDto in postDtos)
{
postDto.Tags = await GetTagsOfPost(postDto.Id);
postDto.CommentCount = await _commentRepository.GetCommentCountOfPostAsync(postDto.Id);
}
foreach (var postDto in postDtos)

Loading…
Cancel
Save