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