public GroupDetailTeacherDTO(Group group) : base(group) { Tasks = new HashSet <TaskDetailDTO>(); HashSet <int> taskNumbers = new HashSet <int>(); if (group != null) { if (group.Lesson != null) { Lesson = new LessonListDTO(group.Lesson, null); } if (group.Lesson.Assignment != null) { Assignment = new AssignmentListDTO(group.Lesson.Assignment); } if (group.Lesson.Assignment.Course != null) { Course = new CourseListDTO(group.Lesson.Assignment.Course); } foreach (Evaluation evaluation in group.Evaluations) { taskNumbers.Add(evaluation.Task.Number); Tasks.Add(new TaskDetailDTO(evaluation.Task, evaluation)); } foreach (Task task in group.Lesson.Assignment.Tasks) { if (!taskNumbers.Contains(task.Number)) { Tasks.Add(new TaskDetailDTO(task, null)); } } } }
protected AssignmentDetailDTO(Assignment assignment, Tutor tutor) : base(assignment) { if (assignment != null) { Lessons = new HashSet <LessonListDTO>(); if (assignment.Course != null) { Course = new CourseListDTO(assignment.Course); } if (assignment.Lessons != null) { foreach (Lesson lesson in assignment.Lessons) { Lessons.Add(new LessonListDTO(lesson, tutor)); } } } }
public LessonDetailDTO(Lesson lesson) : base(lesson, null) { if (lesson != null) { if (lesson.Assignment != null) { Assignment = new AssignmentListDTO(lesson.Assignment); } if (lesson.Assignment.Course != null) { Course = new CourseListDTO(lesson.Assignment.Course); } Groups = new HashSet <GroupListDTO>(); foreach (Group group in lesson.Groups) { Groups.Add(new GroupListDTO(group)); } if (lesson.DerivedFrom != null) { DerivedFrom = new LessonListDTO(lesson.DerivedFrom, null); } } }