public async Task <TEntity> GetByIdAsync(int id) { using (var db = new BPContext()) { return(await db.Set <TEntity>().FindAsync(id)); } }
public async Task <List <TEntity> > GetAllAsync() { using (var db = new BPContext()) { return(await db.Set <TEntity>().ToListAsync()); } }
public async Task UpdateAsync(TEntity entity) { using (var db = new BPContext()) { db.Set <TEntity>().Update(entity); await db.SaveChangesAsync(); } }