Exemplo n.º 1
0
        public bool AddGarage(Garage newGarage)//method for adding a new garage to a motorcade
        {
            if (Garages.Count > 9)
            {
                Console.WriteLine($"No more space in list of garages for: {newGarage}.");
                return(false);
            }

            foreach (Garage gar in Garages)
            {
                if (gar.Equals(newGarage))
                {
                    Console.WriteLine($"{newGarage} already exists among garages.");
                    return(false);
                }
            }

            Garages.Add(newGarage);
            return(true);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Method that can add garage to list of garages
 /// </summary>
 /// <param name="garage">Garage which needed to add</param>
 public void AddGarage(Garage garage)
 {
     Garages.Add(garage);
 }