TheAirline.Models.Airports.Airport.GetDestinationPassengersObject C# (CSharp) Méthode

GetDestinationPassengersObject() public méthode

public GetDestinationPassengersObject ( Airport destination ) : DestinationDemand
destination Airport
Résultat TheAirline.Models.Passengers.DestinationDemand
        public DestinationDemand GetDestinationPassengersObject(Airport destination)
        {
            return DestinationPassengers.Find(a => a.Destination == destination.Profile.IATACode);
        }

Usage Example

        //changes the demand between two airports
        public static void ChangePaxDemand(Airport airport1, Airport airport2, int value)
        {
            DestinationDemand destPax = airport1.GetDestinationPassengersObject(airport2);

            if (destPax != null && value > 0)
            {
                destPax.Rate += Convert.ToUInt16(value);
            }
            else
            {
                if (value > 0)
                {
                    airport1.AddDestinationPassengersRate(airport2, Convert.ToUInt16(value));
                }
            }
        }