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

            // throw new NotImplementedException();
        }
示例#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();
        }
示例#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();
        }
示例#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());
 }
示例#9
0
        public async Task <TEntity> GetById(int id)
        {
            var context = new JwtContext();

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

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