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));
                    }
                }
            }
        }
Exemple #2
0
 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);
         }
     }
 }