Beispiel #1
0
 /// <summary>Deletes a <see cref="SchoolClass"/>.</summary>
 /// <param name="deleteClass"><see cref="SchoolClass"/> to be deleted</param>
 public static void DeleteClass(SchoolClass deleteClass)
 {
     JSONInteraction.DeleteClass(deleteClass);
     foreach (Teacher teacher in AllTeachers)
     {
         teacher.ClassesTaught.RemoveAll(clsTaught => clsTaught.Equals(deleteClass.Id, StringComparison.OrdinalIgnoreCase));
     }
     foreach (Student student in AllStudents)
     {
         student.EnrolledClasses.RemoveAll(clsTaught => clsTaught.Equals(deleteClass.Id, StringComparison.OrdinalIgnoreCase));
     }
     AllClasses.Remove(deleteClass);
 }
Beispiel #2
0
 /// <summary>Saves a <see cref="SchoolClass"/> to disk.</summary>
 /// <param name="newClass"><see cref="SchoolClass"/> to be saved to disk</param>
 public static void NewClass(SchoolClass newClass)
 {
     JSONInteraction.WriteClass(newClass);
     AllClasses.Add(newClass);
     AllClasses = AllClasses.OrderBy(cls => cls.Id).ToList();
 }