/// <summary> /// Mapea un objeto SchoolClassEntity en un objeto SchoolClass /// incluyendo /// </summary> /// <param name="schoolClassEntity"></param> /// <returns></returns> public static SchoolClass Map(SchoolClassEntity schoolClassEntity) { if (schoolClassEntity is null) { return(null); } else { return(new SchoolClass() { Id = schoolClassEntity.Id, Day = (DayOfWeek)schoolClassEntity.Day, Subject = SubjectMapper.Map(schoolClassEntity.SubjectEntity), Schedule = ScheduleMapper.Map(schoolClassEntity.ScheduleEntity) }); } }
/// <summary> /// Mapea un objeto CourseEntity en un objeto Course /// incluyendo las asignaturas, las cuales incluyen el /// profesor asignado /// </summary> /// <param name="courseEntity"></param> /// <returns></returns> public static Course MapIncludingSubjects(CourseEntity courseEntity) { if (courseEntity is null) { return(null); } else { return(new Course() { Id = courseEntity.Id, Year = courseEntity.Year, SchoolClasses = null, Subjects = courseEntity.CourseSubjectEntities .Select(cs => SubjectMapper.MapIncludingTeacher(cs.SubjectEntity)).ToList() }); } }
/// <summary> /// Mapea una entidad AbsenceEntity en un objeto Absence /// incluyendo el objeto Schedule y el objeto Subject /// </summary> /// <param name="absenceEntity"></param> /// <returns></returns> public static Absence MapIncludingSchedule(AbsenceEntity absenceEntity) { if (absenceEntity is null) { return(null); } else { return(new Absence() { Id = absenceEntity.Id, Type = absenceEntity.Type, Date = absenceEntity.Date, Schedule = ScheduleMapper.Map(absenceEntity.SchoolClassEntity.ScheduleEntity), Subject = SubjectMapper.Map(absenceEntity.SchoolClassEntity.SubjectEntity), IsExcused = absenceEntity.IsExcused }); } }
/// <summary> /// Mapea un objeto StudentEntity en un objeto Student /// incluyendo el curso que cursa y las asignaturas que cursa /// el alumno /// </summary> /// <param name="studentEntity"></param> /// <returns></returns> public static Student MapIncludingAssignedCourseAndSubjects(StudentEntity studentEntity) { if (studentEntity is null) { return(null); } else { return(new Student() { Id = studentEntity.Id, Dni = studentEntity.Dni, FirstName = studentEntity.FirstName, LastName1 = studentEntity.LastName1, LastName2 = studentEntity.LastName2, Course = CourseMapper.MapIncludingCycle(studentEntity.CourseEntity), Subjects = studentEntity.StudentSubjectEntities .Select(ss => SubjectMapper.Map(ss.SubjectEntity)).ToList(), TotalAbsences = studentEntity.TotalAbsences, TotalDelays = studentEntity.TotalDelays }); } }