Update PostAppService.cs

pull/1162/head
Yunus Emre Kalkan 6 years ago
parent ce66211c87
commit 601143394f

@ -79,24 +79,6 @@ namespace Volo.Blogging.Posts
return new ListResultDto<PostWithDetailsDto>(postDtos); return new ListResultDto<PostWithDetailsDto>(postDtos);
} }
private async Task<List<PostWithDetailsDto>> FilterPostsByTag(List<PostWithDetailsDto> allPostDtos, Tag tag)
{
var filteredPostDtos = new List<PostWithDetailsDto>();
var posts = await _postRepository.GetListAsync();
foreach (var postDto in allPostDtos)
{
if (!postDto.Tags.Any(p=> p.Id == tag.Id))
{
continue;
}
filteredPostDtos.Add(postDto);
}
return filteredPostDtos;
}
public async Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input) public async Task<PostWithDetailsDto> GetForReadingAsync(GetPostInput input)
{ {
var post = await _postRepository.GetPostByUrl(input.BlogId, input.Url); var post = await _postRepository.GetPostByUrl(input.BlogId, input.Url);
@ -273,5 +255,23 @@ namespace Volo.Blogging.Posts
} }
return new List<string>(tags.Split(",").Select(t => t.Trim())); return new List<string>(tags.Split(",").Select(t => t.Trim()));
} }
private async Task<List<PostWithDetailsDto>> FilterPostsByTag(List<PostWithDetailsDto> allPostDtos, Tag tag)
{
var filteredPostDtos = new List<PostWithDetailsDto>();
var posts = await _postRepository.GetListAsync();
foreach (var postDto in allPostDtos)
{
if (!postDto.Tags.Any(p => p.Id == tag.Id))
{
continue;
}
filteredPostDtos.Add(postDto);
}
return filteredPostDtos;
}
} }
} }

Loading…
Cancel
Save