RemoveAirport() public method

public RemoveAirport ( Airport airport ) : void
airport TheAirline.Models.Airports.Airport
return void
コード例 #1
0
        public void SwitchAirline(Airline airlineFrom, Airline airlineTo)
        {
            List<AirportContract> contracts = Airport.GetAirlineContracts(airlineFrom);

            foreach (AirportContract contractFrom in contracts)
            {
                contractFrom.Airline = airlineTo;

                for (int i = 0; i < contractFrom.NumberOfGates; i++)
                {
                    Gate gate = contractFrom.Airport.Terminals.GetGates().First(g => g.Airline == airlineFrom);
                    gate.Airline = airlineTo;
                }
            }

            airlineFrom.RemoveAirport(Airport);

            if (!airlineTo.Airports.Contains(Airport))
            {
                airlineTo.AddAirport(Airport);
            }
        }