public ClassResponse Map(Class _class) { if (_class == null) { return(null); } var classResponse = new ClassResponse { Id = _class.Id, Name = _class.Name, TaughtBy = HelperMapper.BasicMap(_class.Teacher), PupilInClass = _class.PupilInClass .Select(x => HelperMapper.BasicMap(x.Pupil)) }; return(classResponse); }
public TeacherResponse Map(Teacher teacher) { if (teacher == null) { return(null); } var teacherResponse = new TeacherResponse { Id = teacher.Id, Firstname = teacher.Firstname, Lastname = teacher.Lastname, TeachesCourses = teacher.Course.Select(HelperMapper.BasicMap), TeachesInSchool = HelperMapper.BasicMap(teacher.School), TeachesClasses = teacher.Class.Select(HelperMapper.BasicMap) }; return(teacherResponse); }
public PupilResponse Map(Pupil pupil) { if (pupil == null) { return(null); } var pupilResponse = new PupilResponse { Id = pupil.Id, Firstname = pupil.Firstname, EnrolledInClasses = pupil.PupilInClass .Select(x => HelperMapper.BasicMap(x.Class)), EnrolledInCourses = pupil.PupilInCourse .Select(x => HelperMapper.BasicMap(x.Course)) }; return(pupilResponse); }
public CourseResponse Map(Course course) { if (course == null) { return(null); } var courseResponse = new CourseResponse { Id = course.Id, Name = course.Name, TaughtInSeason = course.CourseNavigation?.Name, TaughtBy = HelperMapper.BasicMap(course.Teacher), EnrolledPupils = course.PupilInCourse .Select(x => HelperMapper.BasicMap(x.Pupil)) }; return(courseResponse); }