[HttpPost("add")]//ROUTE public IActionResult Add([FromBody] HobbyDto hobbyDto) { // map dto to entity var hobby = _mapper.Map <Hobby>(hobbyDto); try { // save _hobbyService.Add(hobby); return(Ok(hobby)); } catch (AppException ex) { // return error message if there was an exception return(BadRequest(new { message = ex.Message })); } }