Beispiel #1
0
        private async Task <FlightDto> CompleteFlight(FlightDto flight)
        {
            var destination = await _airportService.GetAsync(flight.DestinationAirportId);

            var departure = await _airportService.GetAsync(flight.DepartureAirportId);

            var aircraft = await _aircraftService.GetAsync(flight.AircraftId);

            if (destination == null || departure == null || aircraft == null)
            {
                throw new ArgumentNullException(nameof(CompleteFlight));
            }

            flight.Distance        = DistanceBetweenPlaces(departure, destination);
            flight.FuelConsumption = FuelConsumption(aircraft, flight.Distance);

            return(flight);
        }