public _TripsTableModel(ApplicationDbContext db, ETripFilter tripFilter) { _customerController = new CustomerController(db); _tripController = new TripController(db); _carController = new CarController(db); TripFilter = tripFilter; }
public async Task <IActionResult> GetByDateTime(ETripFilter tripFilter) { var trips = new List <Trip>(); if (tripFilter == ETripFilter.ARRIVAL) { trips = await _db.Trips.Where(x => x.ArrivalDateTime.Value.Date == DateTime.Today).ToListAsync(); } else if (tripFilter == ETripFilter.RETURN) { trips = await _db.Trips.Where(x => x.ReturnDateTime.Value.Date == DateTime.Today).ToListAsync(); } return(new OkObjectResult(trips)); }