public IActionResult Post([FromBody] Course course) { if (ModelState.IsValid) { bool result = repository.AddCourse(course); if (result) { return(Created("AddCourse", course.Id)); } return(StatusCode(StatusCodes.Status500InternalServerError)); } return(BadRequest(ModelState)); }
public async Task<IActionResult> PostCourse([FromBody] CourseDto course) { if (ModelState.IsValid) { bool result = repository.AddCourse(course); if (result) { return Ok("AddCourse"); } return StatusCode(StatusCodes.Status500InternalServerError); } return BadRequest(ModelState); }