public List <Brand> GetAll(Expression <Func <Brand, bool> > filter = null) { using (ReCapDemoDatabaseContext context = new ReCapDemoDatabaseContext()) { return(filter == null?context.Set <Brand>().ToList() : context.Set <Brand>().Where(filter).ToList()); } }
public Brand Get(Expression <Func <Brand, bool> > filter) { using (ReCapDemoDatabaseContext context = new ReCapDemoDatabaseContext()) { return(context.Set <Brand>().SingleOrDefault(filter)); } }