/// <summary> /// Get a flight plan from the database and return it. /// </summary> /// <param name="id"> The id of the flight plan. </param> /// <returns> The flight plan. </returns> public async Task <FlightPlan> GetFlightPlan(string id) { // Try get the flight plan from the local data base. FlightPlan local = await flightsDB.GetFlightPlan(id); if (local != null) { return(local); } /* If flight plan not in local data base, try to retrieve it from an * external server. * Get the server in which the flight plan is located. */ FlightServer relevantServer = await flightsServersDB.GetFlightServer(id); if (relevantServer != null) { // Ask the external server for the flight plan. Server server = await serversDB.GetServer(relevantServer.ServerId); IHTTPClient client = new HTTPClient(server); return(await client.GetFlightPlan(id)); } return(null); }