public virtual List <T> ObtenerTodos()
 {
     using (var db = new ContextoDB())
     {
         return(db.Set <T>().ToList());
     }
 }
 public virtual T Buscar(Expression <Func <T, bool> > expresion)
 {
     using (var db = new ContextoDB())
     {
         return(db.Set <T>().Where(expresion).FirstOrDefault());
     }
 }
Exemple #3
0
 public IEnumerable <T> ObterTodos()
 {
     return(Contexto.Set <T>());
 }
 public async Task DeleteAsync(Tentity entity)
 {
     _dbcontext.Set <Tentity>().Remove(entity);
     await _dbcontext.SaveChangesAsync();
 }