Exemplo n.º 1
0
        public async Task <T> Insert(T entity)
        {
            await context.Set <T>().AddAsync(entity);

            await context.SaveChangesAsync();

            return(entity);
        }
Exemplo n.º 2
0
 public Repository(HahnDbContext context)
 {
     this.context = context;
     entities     = context.Set <T>();
 }
Exemplo n.º 3
0
 public Repository(HahnDbContext db)
 {
     Db    = db;
     DbSet = db.Set <TEntity>();
 }
Exemplo n.º 4
0
 public async Task <int> CountAll() => await _context.Set <TEntity>().CountAsync();
Exemplo n.º 5
0
 public virtual Task <T> GetItemByIdAsync(int id)
 {
     return(_context.Set <T>().Where(c => c.ID.Equals(id)).FirstOrDefaultAsync());
 }
Exemplo n.º 6
0
 public DataRepository(HahnDbContext context)
 {
     _context = context;
     DbSet    = context.Set <TEntity>();
 }