Exemplo n.º 1
0
 public void AddTeacher(ITeacher teacher)
 {
     if (teacher == null)
     {
         throw new ArgumentNullException(nameof(teacher));
     }
     NameTeacher = teacher.Name.ToString() ?? throw new ArgumentException("invalid teacher");
     teacher.AddSubject(this);
 }
Exemplo n.º 2
0
        public void AddSubjectToTeacher(string id, string nameSubject)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (nameSubject == null)
            {
                throw new ArgumentNullException(nameof(nameSubject));
            }
            ITeacher t = GetTeacher(id);
            ISubject s = GetSubject(nameSubject);

            if (s != null)
            {
                s.AddTeacher(t);
                t.AddSubject(s);
            }
        }