public List <Users> GetAll(Expression <Func <Users, bool> > filter = null) { using (RentaCarContext context = new RentaCarContext()) { return(filter == null?context.Set <Users>().ToList() : context.Set <Users>().Where(filter).ToList()); } }
public List <Car> GetAll(Expression <Func <Car, bool> > filter = null) { using (RentaCarContext context = new RentaCarContext()) { #region information //filtre null ise contextdeki car tablosuna yerleş ve oradaki tüm datayı getir.Null değilse filtreyi uygula getir. //Arka planda select * from Car çalıştırıyor. #endregion return(filter == null?context.Set <Car>().ToList() : context.Set <Car>().Where(filter).ToList()); } }
public Users Get(Expression <Func <Users, bool> > filter) { using (RentaCarContext context = new RentaCarContext()) { return(context.Set <Users>().SingleOrDefault(filter)); } }
public Brand Get(Expression <Func <Brand, bool> > filter) { using (RentaCarContext context = new RentaCarContext()) { return(context.Set <Brand>().SingleOrDefault(filter)); } }
public Customer Get(Expression <Func <Customer, bool> > filter) { using (RentaCarContext context = new RentaCarContext()) { return(context.Set <Customer>().FirstOrDefault(filter)); } }
public Rental Get(Expression <Func <Rental, bool> > filter) { using (RentaCarContext context = new RentaCarContext()) { return(context.Set <Rental>().FirstOrDefault(filter)); } }
public Color Get(Expression <Func <Color, bool> > filter) { using (RentaCarContext context = new RentaCarContext()) { return(context.Set <Color>().SingleOrDefault(filter)); } }