예제 #1
0
파일: Teacher.cs 프로젝트: artbas95/School
 private void CheckSubject(SchoolSubject sc)
 {
     if (sc == null)
     {
         throw new ArgumentNullException("Nauczyciel musi uczyć minimum jednego przedmiotu");
     }
 }
예제 #2
0
파일: Teacher.cs 프로젝트: artbas95/School
 public Teacher(SchoolSubject sc)
 {
     CheckSubject(sc);
     _subjects = new HashSet <SchoolSubject> {
         sc
     };
 }
예제 #3
0
파일: Teacher.cs 프로젝트: artbas95/School
 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);
     }
 }
예제 #4
0
파일: Teacher.cs 프로젝트: artbas95/School
 public bool Add(SchoolSubject subject)
 {
     return(_subjects.Add(subject));
 }