public async Task <ActionResult <List <Route> > > Index(string alias) { var airport = await _airportsProvider.GetAirport(alias); if (airport == null) { throw new ArgumentException($"Airport with alias '{alias}' doesn't exist."); } return(await airport.GetRoutes()); }
private async Task <Route> ConvertToRoute(PlainRoute plainRoute) { return(new Route { Departure = await _airportsProvider.GetAirport(plainRoute.SrcAirport), Destination = await _airportsProvider.GetAirport(plainRoute.DestAirport), Airline = new Airline { Alias = plainRoute.Airline } }); }