public IEnumerable <Rental> GetCurrentlyRentedCars() { using (var context = new CarRentalContext()) { return(context.RentalSet .Where(e => e.DateRented == null) .ToList()); } }
public IEnumerable <Rental> GetRentalHistoryByCar(int carId) { using (var context = new CarRentalContext()) { return(context.RentalSet .Where(e => e.CarId == carId) .ToList()); } }
public Account GetByLogin(string login) { using (CarRentalContext entityContext = new CarRentalContext()) { return((from a in entityContext.AccountSet where a.LoginEmail == login select a).FirstOrDefault()); } }
public Rental[] GetRentalHistoryByAccount(int accountId) { using (var context = new CarRentalContext()) { return(context.RentalSet .Where(e => e.AccountId == accountId) .ToArray()); } }
public IEnumerable <Reservation> GetReservationsByPickupDate(DateTime pickupDate) { using (var context = new CarRentalContext()) { return(context.ReservationSet .Where(e => e.RentalDate < pickupDate) .ToList()); } }
public IEnumerable <Rental> GetCurrentlyRentedCars() { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.RentalSet where r.DateReturned == null select r; return(query.ToFullyLoaded()); } }
public Rental GetCurrentRentalByCar(int carId) { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.RentalSet where r.CarId == carId && r.DateReturned == null select r; return(query.FirstOrDefault()); } }
public IEnumerable <Rental> GetRentalHistoryByCar(int carId) { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.RentalSet where r.CarId == carId select r; return(query.ToFullyLoaded()); } }
public IEnumerable <Rental> GetRentalHistoryByAccount(int accountId) { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from e in entityContext.RentalSet where e.AccountId == accountId select e; return(query.ToFullyLoaded()); } }
public IEnumerable <Reservation> GetReservationsByPickupDate(DateTime pickupDate) { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.ReservationSet where r.RentalDate < pickupDate select r; return(query.ToFullyLoaded()); } }
protected override Rental GetEntity(CarRentalContext entityContext, int id) { var query = (from e in entityContext.RentalSet where e.RentalId == id select e); var results = query.FirstOrDefault(); return(results); }
protected override Rental GetEntity(CarRentalContext entityContext, object id) { int idToFind = (int)id; var query = from e in entityContext.RentalSet where e.RentalId == idToFind select e; var result = query.FirstOrDefault(); return(result); }
protected override Account GetEntity(CarRentalContext entityContext, object id) { int idToGet = (int)id; var query = from e in entityContext.AccountSet where e.AccountId == idToGet select e; var result = query.FirstOrDefault(); return(result); }
public IEnumerable <CustomerReservationInfo> GetCurrentCustomerReservationInfo() { using (var context = new CarRentalContext()) { return(context.ReservationSet .Join(context.AccountSet, r => r.AccountId, a => a.AccountId, (r, a) => new { r, a }) .Join(context.CarSet, ra => ra.r.CarId, c => c.CarId, (ra, c) => new CustomerReservationInfo { Customer = ra.a, Reservation = ra.r, Car = c }) .ToList()); } }
public IEnumerable <Contracts.CustomerReservationInfo> GetCurrentCustomerReservationInfo() { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.ReservationSet join a in entityContext.AccountSet on r.AccountId equals a.AccountId join c in entityContext.CarSet on r.CarId equals c.CarId select new CustomerReservationInfo() { Customer = a, Car = c, Reservation = r }; return(query.ToFullyLoaded()); } }
public IEnumerable <CustomerRentalInfo> GetCurrentCustomerRentalInfo() { using (CarRentalContext entityContext = new CarRentalContext()) { var query = from r in entityContext.RentalSet where r.DateReturned == null join a in entityContext.AccountSet on r.AccountId equals a.AccountId join c in entityContext.CarSet on r.CarId equals c.CarId select new CustomerRentalInfo() { Customer = a, Car = c, Rental = r }; return(query.ToFullyLoaded()); } }
protected override Account UpdateEntity(CarRentalContext entityContext, Account entity) { return((from e in entityContext.AccountSet where e.AccountId == entity.AccountId select e).FirstOrDefault()); }
protected override Account AddEntity(CarRentalContext entityContext, Account entity) { return(entityContext.AccountSet.Add(entity)); }
protected override Car UpdateEntity(CarRentalContext entityContext, Car entity) { return(entityContext.CarSet .FirstOrDefault(e => e.CarId == entity.CarId)); }
protected override Car GetEntity(CarRentalContext entityContext, int id) { return(entityContext.CarSet.Find(id)); }
protected override IEnumerable <Car> GetEntities(CarRentalContext entityContext) { return(entityContext.CarSet.ToList()); }
protected override Car AddEntity(CarRentalContext entityContext, Car entity) { return(entityContext.CarSet.Add(entity)); }
public Repository(CarRentalContext ctx) { context = ctx; context.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking; }
protected override Account UpdateEntity(CarRentalContext entityContext, Account entity) { return(entityContext.AccountSet .FirstOrDefault(e => e.AccountId == entity.AccountId)); }
protected override Rental UpdateEntity(CarRentalContext entityContext, Rental entity) { return(entityContext.RentalSet .FirstOrDefault(e => e.RentalId == entity.RentalId)); }
protected override Rental AddEntity(CarRentalContext entityContext, Rental entity) { return(entityContext.RentalSet.Add(entity)); }
public EditModel(CarRental.Data.CarRentalContext context) { _context = context; }
protected override IEnumerable <Account> GetEntities(CarRentalContext entityContext) { return(from e in entityContext.AccountSet select e); }
protected override Rental UpdateEntity(CarRentalContext entityContext, Rental entity) { return((from e in entityContext.RentalSet where e.RentalId == entity.RentalId select e).FirstOrDefault()); }
protected override Car UpdateEntity(CarRentalContext entityContext, Car entity) { return((from e in entityContext.CarSet where e.CarId == entity.CarId select e).FirstOrDefault()); }