public async Task <Distance> HandleAsync(CalculateDistanceCommand command)
        {
            var airportA = await _airportQueryService.GetAsync(command.IataA);

            var airportB = await _airportQueryService.GetAsync(command.IataB);

            var geoA = airportA.Coordinates.GetGeoCoordinate();
            var geoB = airportB.Coordinates.GetGeoCoordinate();

            if (OneOfCoordinatesMissing(geoA, geoB))
            {
                return(null);
            }

            return(new Distance {
                Meters = geoA.GetDistanceTo(geoB)
            });
        }
Exemple #2
0
 private static void CalculateDistance(string command)
 {
     ICommand<double> cmd = new CalculateDistanceCommand(provider, command);
     Console.WriteLine("Distance between these systems is: {0:N2} ly", cmd.Execute());
 }