Created
August 2, 2019 08:55
-
-
Save ngohungphuc/aa8357221e87567ccbe6b792c505726c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Repository | |
{ | |
private readonly AppDbContext _appDbContext; | |
public Repository(AppDbContext appDbContext) | |
{ | |
_appDbContext = appDbContext; | |
} | |
public IQueryable<Post> GetPostQuery() | |
{ | |
return _appDbContext.Posts.AsQueryable(); | |
} | |
public async Task<IEnumerable<Comment>> GetCommentByPostId(int postId) | |
{ | |
return await _appDbContext.Comments.Where(x => x.PostId == postId).ToListAsync(); | |
} | |
public IQueryable<Comment> GetCommentQuery() | |
{ | |
return _appDbContext.Comments.AsQueryable(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment