public async Task <IActionResult> Post([FromBody] CreateCourseDto createCourseDto) { var lecturerId = createCourseDto.LecturerId; var lecturer = await _lecturerRepo.FindAsync(lecturerId); var course = await _coursesService.CreateAsync(createCourseDto.Name, lecturer, createCourseDto.Capacity); return(Ok(course)); }
public async Task <IActionResult> Post([FromBody] CreateCourseDto createCourseDto) { try { courseService.Create(createCourseDto); return(Ok()); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
public async Task <IActionResult> Post([FromBody] CreateCourseDto createCourseDto) { try { bool mock = true; // change this to false to remove the mock if (!mock) { _coursesService.CreateCourse(createCourseDto); } return(Ok()); } catch (Exception e) { return(BadRequest(e)); } }
public Task <IActionResult> Post([FromBody] CreateCourseDto createCourseDto) { throw new NotImplementedException(); }