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