Beispiel #1
0
 public Task <List <Post> > GetLatestPosts()
 {
     return(IncludedQueryable
            .Where(post => !post.IsPrivate)
            .OrderByDescending(post =>
                               post.Id).Take(3).ToListAsync());
 }
Beispiel #2
0
 public Task <List <Post> > GetFeaturedPosts()
 {
     return(IncludedQueryable
            .Where(post => post.Featured)
            .OrderByDescending(post => post.Id)
            .Take(3)
            .ToListAsync());
 }
Beispiel #3
0
 public Task <List <Post> > GetForCharacterIdAsync(long characterId)
 {
     return(IncludedQueryable.Where(post =>
                                    post.IsPrivate == false &&
                                    post.CharacterId.HasValue &&
                                    post.CharacterId == characterId)
            .ToListAsync());
 }
Beispiel #4
0
 public Task <Post> GetPublicByIdAsync(long id, long userId)
 {
     return(IncludedQueryable
            .FirstOrDefaultAsync(
                post => post.Id == id &&
                (post.IsPrivate == false ||
                 post.AuthorId == userId)));
 }
Beispiel #5
0
 public Task <List <Post> > GetForUserIdAsync(long userId, bool getPrivate)
 {
     return(IncludedQueryable
            .Where(post =>
                   post.AuthorId == userId &&
                   getPrivate
             ? getPrivate
             : post.IsPrivate)
            .ToListAsync());
 }
Beispiel #6
0
 public Task <List <Post> > GetPostsByGameId(long gameId)
 {
     return(IncludedQueryable
            .Where(post => post.GameId == gameId && !post.IsPrivate)
            .ToListAsync());
 }
Beispiel #7
0
 public Task <List <Post> > GetPublicPostListAsync(long userId)
 {
     return(IncludedQueryable
            .Where(post => post.IsPrivate == false || post.AuthorId == userId)
            .ToListAsync());
 }