Ejemplo n.º 1
0
 public List <T> GetList(Expression <Func <T, bool> > filter = null)
 {
     using (var context = new PortfolioContext())
     {
         return(filter == null
             ? context.Set <T>().ToListAsync().Result
             : context.Set <T>().Where(filter).ToList());
     }
 }
Ejemplo n.º 2
0
 public T Get(Expression <Func <T, bool> > filter)
 {
     using (var context = new PortfolioContext())
     {
         return(context.Set <T>().SingleOrDefaultAsync(filter).Result);
     }
 }