public void AddTelephone(string modele, int stoimost, string firma, FirmaController firmscontroller) { foreach (Firma itemfirma in firmscontroller.GetFirms()) { if (itemfirma.Name == firma) { telephones.Add(new Telephone(modele, stoimost, itemfirma)); return; } else { firmscontroller.Add(firma); Firma newFirma = firmscontroller.GetFirmabyName(firma); telephones.Add(new Telephone(modele, stoimost, newFirma)); return; } } }
public Telephone(string modele, int stoimost, Firma firma) : this(modele, stoimost) { Firma = firma ?? throw new ArgumentException(nameof(firma)); }