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)); }
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()); }
public IQueryable <Post> GetAll(bool onlyPublished = true) { return(QueryAll.Where(p => !onlyPublished || p.IsPublished).OrderByDescending(p => p.Created)); }
public async Task <IReadOnlyList <Post> > GetAllAsync(bool onlyPublished = true) { return(await QueryAll.Where(p => !onlyPublished || p.IsPublished).OrderByDescending(p => p.Created).ToListAsync()); }