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));
     }
 }
예제 #5
0
 public Customer Get(Expression <Func <Customer, bool> > filter)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         return(context.Set <Customer>().FirstOrDefault(filter));
     }
 }
예제 #6
0
 public Rental Get(Expression <Func <Rental, bool> > filter)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         return(context.Set <Rental>().FirstOrDefault(filter));
     }
 }
예제 #7
0
 public Color Get(Expression <Func <Color, bool> > filter)
 {
     using (RentaCarContext context = new RentaCarContext())
     {
         return(context.Set <Color>().SingleOrDefault(filter));
     }
 }