public async Task <IEnumerable <Flight> > Get([FromQuery] DateTime relative_to) { bool isExternal = Request.QueryString.Value.Contains("sync_all"); List <Flight> flights = new List <Flight>(); List <string> flightsIDs = (List <string>)_flightPlansDataBase.GetAllKeys(); foreach (string id in flightsIDs) { FlightPlan plan = _flightPlansDataBase.GetById(id); if (plan.InFlightRelativeTo(relative_to)) { var tuple = plan.Interpolate(relative_to); Flight flight = new Flight(id, tuple.Item1, tuple.Item2, plan.Passengers, plan.CompanyName, relative_to, false); flights.Add(flight); } } if (isExternal) { flights.AddRange(await GetExternalFlights(relative_to)); } return(flights); }