public List <Car> GetAll(Expression <Func <Car, bool> > filter = null) { using (ReCapDbContext context = new ReCapDbContext()) {//filtre vermemişsek 1. adım filtre vermişsek 2. adım yani where şartı ile belirttiğimiz filtre dönecektir. return(filter == null?context.Set <Car>().ToList() : context.Set <Car>().Where(filter).ToList()); } }
public List <Brand> GetAll(Expression <Func <Brand, bool> > filter = null) { using (ReCapDbContext context = new ReCapDbContext()) { return(filter == null?context.Set <Brand>().ToList() : context.Set <Brand>().Where(filter).ToList()); } }
public Car Get(Expression <Func <Car, bool> > filter) { using (ReCapDbContext context = new ReCapDbContext()) { return(context.Set <Car>().SingleOrDefault(filter)); // Tek veri dönecektir.(SingleOrDefault) } }
public Brand Get(Expression <Func <Brand, bool> > filter) { using (ReCapDbContext context = new ReCapDbContext()) { return(context.Set <Brand>().SingleOrDefault(filter)); } }
public List <Entities.Concrete.Color> GetAll(Expression <Func <Entities.Concrete.Color, bool> > filter = null) { using (ReCapDbContext context = new ReCapDbContext()) { return(filter == null?context.Set <Entities.Concrete.Color>().ToList() : context.Set <Entities.Concrete.Color>().Where(filter).ToList()); } }
public Entities.Concrete.Color Get(Expression <Func <Entities.Concrete.Color, bool> > filter) { using (ReCapDbContext context = new ReCapDbContext()) { return(context.Set <Entities.Concrete.Color>().SingleOrDefault(filter)); } }