diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 8799b4e0d0..5ba5a11e9f 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -36,19 +36,19 @@ namespace Volo.Blogging.Posts var userDictionary = new Dictionary(); var postDtos = new List(ObjectMapper.Map, List>(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)