Beispiel #1
0
        public static TeacherBasicDTO TeacherToTeacherBasicDTO(Teacher teacher)
        {
            TeacherBasicDTO retVal = new TeacherBasicDTO();

            retVal.Id              = teacher.Id;
            retVal.FirstName       = teacher.FirstName;
            retVal.LastName        = teacher.LastName;
            retVal.UserName        = teacher.UserName;
            retVal.Email           = teacher.Email;
            retVal.TeachesSubjects = teacher.TeacherSchoolSubjects
                                     .Where(x => x.Teacher.Id == teacher.Id)
                                     .Select(x => SchoolSubjectToSchoolSubjectDTOConverters.SchoolSubjectToSchoolSubjectDTO(x.SchoolSubject));

            logger.Info("Coverting Teacher to TeacherBasicDTO.");
            return(retVal);
        }
        public static GradeDTO GradeToGradeDTO(Grade grade)
        {
            GradeDTO retVal = new GradeDTO()
            {
                Id            = grade.Id,
                Value         = grade.Value,
                DateOfGrading = grade.DateOfGrading,

                Subject = SchoolSubjectToSchoolSubjectDTOConverters
                          .SchoolSubjectToSchoolSubjectDTO(grade.SchoolClassTeacherSchoolSubject.TeacherSchoolSubject.SchoolSubject),

                GradingTeacher = UserToUserDTOConverters
                                 .UserToUserSimpleViewDTO(grade.SchoolClassTeacherSchoolSubject.TeacherSchoolSubject.Teacher),

                Student = UserToUserDTOConverters
                          .StudentToStudentBasicDTO(grade.Student)
            };

            logger.Info("Converting Grade to GradeDTO.");
            return(retVal);
        }