public async Task <T> Insert(T entity) { await context.Set <T>().AddAsync(entity); await context.SaveChangesAsync(); return(entity); }
public Repository(HahnDbContext context) { this.context = context; entities = context.Set <T>(); }
public Repository(HahnDbContext db) { Db = db; DbSet = db.Set <TEntity>(); }
public async Task <int> CountAll() => await _context.Set <TEntity>().CountAsync();
public virtual Task <T> GetItemByIdAsync(int id) { return(_context.Set <T>().Where(c => c.ID.Equals(id)).FirstOrDefaultAsync()); }
public DataRepository(HahnDbContext context) { _context = context; DbSet = context.Set <TEntity>(); }