public IActionResult UpdateCourse([FromBody] CourseDTO courseToUpdate) { var course = courseService.GetCourseByID(courseToUpdate.ID); if (course == null) { return(NotFound()); } courseService.UpdateCourse(courseToUpdate.ID, courseToUpdate.Name, courseToUpdate.StudyPoints, courseToUpdate.Category, courseToUpdate.ProfessorID); return(NoContent()); }
public CourseDTO ToDTO(Course course) { var courseDTO = new CourseDTO(); courseDTO.ID = course.ID; courseDTO.Name = course.Name; courseDTO.StudyPoints = course.StudyPoints; courseDTO.Category = course.Category; courseDTO.ProfessorID = course.ProfessorID; return(courseDTO); }