示例#1
0
        public IActionResult CreatePokemon([Required][FromBody] CreatePokemonDto createPokemon)
        {
            try
            {
                var response = _repo.Create(createPokemon);

                return(StatusCode((int)HttpStatusCode.Created, JsonConvert.SerializeObject($"/Pokedex/pokemon/{response}")));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }