Ejemplo n.º 1
0
        public async Task <IActionResult> Update(string id, [FromBody] Joke joke)
        {
            var exists = _jokeRepository.GetById(id) != null;

            if (!exists)
            {
                return(BadRequest());
            }

            var result = await _jokeRepository.Update(joke);

            return(Ok(result));
        }
        public async Task <IActionResult> Update(string id, [FromBody] Joke joke)
        {
            bool exists = _jokeProvider.GetById(id) != null;

            if (!exists)
            {
                return(BadRequest());
            }

            Joke result = await _jokeProvider.Update(joke);

            return(Ok(result));
        }