public void LeaveCourse(Course course) { if (course == null) { throw new ArgumentNullException("Course cannot be null"); } course.RemoveStudent(this); }
public void JoinCourse(Course course) { if (course == null) { throw new ArgumentNullException("Course cannot be null"); } course.AddStudent(this); }
public void AddCourse(Course course) { if (course == null) { throw new ArgumentNullException("Course cannot be null"); } if (this.Courses.Contains(course)) { throw new InvalidOperationException("This school already contains this course"); } this.Courses.Add(course); }
public void RemoveCourse(Course course) { if (course == null) { throw new ArgumentNullException("Course cannot be null"); } if (!this.Courses.Contains(course)) { throw new InvalidOperationException("This school doesnt contains this course"); } this.Courses.Remove(course); }