private void CheckSubject(SchoolSubject sc) { if (sc == null) { throw new ArgumentNullException("Nauczyciel musi uczyć minimum jednego przedmiotu"); } }
public Teacher(SchoolSubject sc) { CheckSubject(sc); _subjects = new HashSet <SchoolSubject> { sc }; }
public bool Remove(string subjectName) { try { SchoolSubject subject = _subjects.Single(x => x.Name.Equals(subjectName)); _subjects.Remove(subject); return(true); } catch (System.InvalidOperationException) { return(false); } }
public bool Add(SchoolSubject subject) { return(_subjects.Add(subject)); }