/// <summary> /// Lista todas las asignaturas de un curso /// </summary> /// <param name="courseId"> /// El id del curso /// </param> /// <returns> /// Retorna una lista de objetos Subject /// </returns> public async Task <List <Subject> > GetByCourse(int courseId) { List <SubjectEntity> subjectEntities = await _subjectRepository .GetByCourseIncludingAssignedTeacher(courseId); List <Subject> subjects = subjectEntities .Select(s => SubjectMapper.MapIncludingTeacher(s)) .ToList(); return(subjects); }
/// <summary> /// Cambia el profesor asignado a una asignatura /// </summary> /// <param name="subjectId"> /// El id de la asignatura /// </param> /// <param name="teacherId"> /// El id del profesor /// </param> /// <returns> /// Retorna el objeto asignatura que contiene /// el nuevo objeto Teacher asignado /// </returns> public async Task <Subject> UpdateAssignedTeacher(int subjectId, int teacherId) { TeacherEntity teacherEntity = await _teachertRepository.Get(teacherId); SubjectEntity subjectEntity = await _subjectRepository .UpdateAssignedTeacher(subjectId, teacherEntity); Subject subject = SubjectMapper.MapIncludingTeacher(subjectEntity); return(subject); }