Example #1
0
 public async Task <TEntity> GetAsync(Expression <Func <TEntity, bool> > filter)
 {
     using var context = new UdemyBlogWebSiteContext();
     return(await context.Set <TEntity>().FirstOrDefaultAsync(filter));
 }
Example #2
0
 public async Task <List <TEntity> > GetAllAsync(Expression <Func <TEntity, bool> > filter)
 {
     using var context = new UdemyBlogWebSiteContext();
     return(await context.Set <TEntity>().Where(filter).ToListAsync());
 }
Example #3
0
 public async Task <List <TEntity> > GetAllAsync <TKey>(Expression <Func <TEntity, TKey> > keySelector)//Sort edilmiş hali
 {
     using var context = new UdemyBlogWebSiteContext();
     return(await context.Set <TEntity>().OrderByDescending(keySelector).ToListAsync());
 }
Example #4
0
 public async Task <List <TEntity> > GetAllAsync()
 {
     using var context = new UdemyBlogWebSiteContext();
     return(await context.Set <TEntity>().ToListAsync());
 }