Esempio n. 1
0
        public async Task <TEntity> GetById(int id)
        {
            using var context = new JwtContext();
            return(await context.Set <TEntity>().FindAsync(id));

            // throw new NotImplementedException();
        }
Esempio n. 2
0
        public async Task <TEntity> GetByFilter(Expression <Func <TEntity, bool> > filter)
        {
            using var context = new JwtContext();
            return(await context.Set <TEntity>().FirstOrDefaultAsync(filter));

            //throw new NotImplementedException();
        }
Esempio n. 3
0
        public async Task <List <TEntity> > GetAllByFilter(Expression <Func <TEntity, bool> > filter)
        {
            using var context = new JwtContext();
            return(await context.Set <TEntity>().Where(filter).ToListAsync());

            //throw new NotImplementedException();
        }
Esempio n. 4
0
        public async Task <List <TEntity> > GetAll()
        {
            //throw new NotImplementedException();

            using var context = new JwtContext();
            return(await context.Set <TEntity>().ToListAsync());
        }
 public async Task <T> GetById(int Id)
 {
     using var context = new JwtContext();
     return(await context.Set <T>().FindAsync(Id));
 }
 public async Task <T> GetByFilter(Expression <Func <T, bool> > filter)
 {
     using var context = new JwtContext();
     return(await context.Set <T>().FirstOrDefaultAsync(filter));
 }
 public async Task <List <T> > GetAllByFilter(Expression <Func <T, bool> > filter)
 {
     using var context = new JwtContext();
     return(await context.Set <T>().Where(filter).ToListAsync());
 }
 public async Task <List <T> > GetAll()
 {
     using var context = new JwtContext();
     return(await context.Set <T>().ToListAsync());
 }
Esempio n. 9
0
        public async Task <TEntity> GetById(int id)
        {
            var context = new JwtContext();

            return(await context.Set <TEntity>().FindAsync(id));
        }
Esempio n. 10
0
        public async Task <TEntity> GetByFilter(Expression <Func <TEntity, bool> > filter)
        {
            var context = new JwtContext();

            return(await context.Set <TEntity>().Where(filter).FirstOrDefaultAsync());
        }
Esempio n. 11
0
 public async Task Update(TEntity entity)
 {
     using var context = new JwtContext();
     context.Set <TEntity>().Update(entity);
     await context.SaveChangesAsync();
 }