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()); } }
public T Get(Expression <Func <T, bool> > filter) { using (var context = new PortfolioContext()) { return(context.Set <T>().SingleOrDefaultAsync(filter).Result); } }