TheAirline.Models.Airports.Airport.AddDestinationPassengersRate C# (CSharp) Method

AddDestinationPassengersRate() public method

public AddDestinationPassengersRate ( Airport destination, ushort rate ) : void
destination Airport
rate ushort
return void
        public void AddDestinationPassengersRate(Airport destination, ushort rate)
        {
            lock (DestinationPassengers)
            {
                DestinationDemand destinationPassengers = GetDestinationPassengersObject(destination);

                if (destinationPassengers != null)
                {
                    destinationPassengers.Rate += rate;
                }
                else
                {
                    DestinationPassengers.Add(new DestinationDemand(destination.Profile.IATACode, rate));
                }
            }
        }

Same methods

Airport::AddDestinationPassengersRate ( DestinationDemand passengers ) : void

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));
                }
            }
        }
All Usage Examples Of TheAirline.Models.Airports.Airport::AddDestinationPassengersRate