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); }
/// <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); }