public IEnumerable <Terminal> GetTerminals(int airportId) { var airport = _airportRepository.GetById(airportId); var ascheme = _airportSchemeRepository.GetMany(s => s.Airport == airport); return(ascheme.Select(t => t.Terminal).Distinct()); }
public void DeleteAirport(int id) { Airport airport = _airportRepository.GetById(id); List <AirportScheme> schemes = _airportSchemeRepository.GetMany(a => a.Airport.Id == airport.Id).ToList(); foreach (AirportScheme scheme in schemes) { _airportSchemeRepository.Delete(scheme); } _airportRepository.Delete(_airportRepository.GetById(id)); SaveAirport(); }
public IEnumerable <IEnumerable <Gate> > GetGates(int airportId) { var airport = _airportRepository.GetById(airportId); var schemes = _airportSchemeRepository.GetMany(asch => asch.Airport == airport); var terminals = schemes.Select(s => s.Terminal).Distinct(); List <List <Gate> > gates = new List <List <Gate> >(); foreach (Terminal terminal in terminals) { gates.Add(schemes.Where(s => s.Terminal == terminal).Select(s => s.Gate).ToList()); } return(gates); }