public void AddReferee() { StreamWriter streamWriter = new StreamWriter("Referees.txt", true); if (Referees.Count >= 1) { Console.WriteLine("W grze moze byc tylko jeden sedzia glowny. "); Console.WriteLine("W meczu moze byc tylko jeden sedzia glowny. "); } else { string imie; string nazwisko; imie = Console.ReadLine(); nazwisko = Console.ReadLine(); VolleyballReferee referee = new VolleyballReferee(imie, nazwisko); Referees.Add(referee); } foreach (VolleyballReferee referee in Referees) { streamWriter.WriteLine(referee); } }
public void DeleteReferee() { if (Referees.Count <= 0) { Console.WriteLine("Brak sedziego"); } else { StreamReader streamReader = new StreamReader("Referees.txt"); string imie; string nazwisko; imie = Console.ReadLine(); nazwisko = Console.ReadLine(); VolleyballReferee newReferee = new VolleyballReferee(imie, nazwisko); foreach (VolleyballReferee referee in Referees) { if (referee == newReferee) { Referees.Remove(referee); } } } }
public void AddMainReferee() { string imie; string nazwisko; imie = Console.ReadLine(); nazwisko = Console.ReadLine(); VolleyballReferee mainReferee = new VolleyballReferee(imie, nazwisko); MainReferee = mainReferee; }