예제 #1
0
 public IQueryable <Post> GetForTag(string tagName)
 {
     return(QueryAll
            .Where(p => p.IsPublished)
            .Where(p => p.Tags.Any(t => t.Name.ToLower().Equals(tagName.ToLower())))
            .OrderByDescending(p => p.Created));
 }
예제 #2
0
 public IQueryable <Post> GetForSearch(string search)
 {
     return(QueryAll
            .Where(p => p.IsPublished)
            .Where(p => p.Title.ToLower().Contains(search.ToLower()))
            .OrderByDescending(p => p.Created));
 }
 public async Task <IReadOnlyCollection <Comment> > GetAllForPost(Guid postId)
 {
     return(await QueryAll
            .Where(c => c.PostId == postId)
            .Include(c => c.User)
            .OrderBy(c => c.Created)
            .ToListAsync());
 }
예제 #4
0
 public IQueryable <Post> GetAll(bool onlyPublished = true)
 {
     return(QueryAll.Where(p => !onlyPublished || p.IsPublished).OrderByDescending(p => p.Created));
 }
예제 #5
0
 public async Task <IReadOnlyList <Post> > GetAllAsync(bool onlyPublished = true)
 {
     return(await QueryAll.Where(p => !onlyPublished || p.IsPublished).OrderByDescending(p => p.Created).ToListAsync());
 }