public async Task Add(T entity)
        {
            await context.Set <T>().AddAsync(entity).ConfigureAwait(false);

            await context.SaveChangesAsync().ConfigureAwait(false);
        }
 public async Task <IEnumerable <Order> > FindAsync(Expression <Func <Order, bool> > expression)
 {
     return(await _WebApiDbContext.Set <Order>().Where(expression).ToListAsync().ConfigureAwait(false));
 }
 public IQueryable <T> GetItems()
 {
     return(db.Set <T>());
 }
示例#4
0
 public virtual TEntity BuscarPorId(int id)
 {
     return(Context.Set <TEntity>().Find(id));
 }
示例#5
0
 /// <summary>
 /// Public Constructor,initializes privately declared local variables.
 /// </summary>
 /// <param name="context"></param>
 public GenericRepository(WebApiDbContext context)
 {
     this.Context = context;
     this.DbSet   = context.Set <TEntity>();
 }