Пример #1
0
        //PUT METHODS
        public CourseTeacherResponseDTO UpdateTeacherOnCourse(UpdateCourseTeacherRequestDTO request)
        {
            //provera da li postoji profesor na kursu
            CourseTeacher oldCourseTeacher = FindTeacherOnCourseOrThrow(request.courseUUID, request.teacherUUID);
            CourseTeacher newCourseTeacher = this._autoMapper.Map <CourseTeacher>(request);

            newCourseTeacher.course = new Course()
            {
                uuid = request.courseUUID
            };
            newCourseTeacher.teacher = new Teacher()
            {
                uuid = request.teacherUUID
            };

            newCourseTeacher = this._queryExecutor.Execute <CourseTeacher>(DatabaseConsts.USER_SCHEMA, this._sqlCommands.UPDATE_TEACHER_COURSE(newCourseTeacher), this._modelMapper.MapToCourseTeacher);

            CourseTeacherResponseDTO response = this._autoMapper.Map <CourseTeacherResponseDTO>(newCourseTeacher);

            return(connectWithUser(response));
        }
 public ActionResult <CourseTeacherResponseDTO> HandleUpdateTeacherOnCourse(UpdateCourseTeacherRequestDTO request)
 {
     return(Ok(this._courseTeacherService.UpdateTeacherOnCourse(request)));
 }