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 5ba5a11e9f..34488f77a1 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 @@ -253,18 +253,8 @@ namespace Volo.Blogging.Posts private Task> FilterPostsByTag(List allPostDtos, Tag tag) { - var filteredPostDtos = new List(); - - foreach (var postDto in allPostDtos) - { - if (postDto.Tags.All(p => p.Id != tag.Id)) - { - continue; - } - - filteredPostDtos.Add(postDto); - } - + var filteredPostDtos = allPostDtos.Where(p => p.Tags?.Any(t => t.Id == tag.Id) ?? false).ToList(); + return Task.FromResult(filteredPostDtos); } }