예제 #1
0
        public async Task <IActionResult> CreateNew([FromBody] Joke joke)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = await _jokeRepository.Add(joke);

            return(CreatedAtAction(nameof(GetById), new { id = result.Id }, result));
        }
        public async Task <IActionResult> CreateNew([FromBody] Joke joke)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            Joke result = await _jokeProvider.Add(joke);

            return(Ok(result));
        }