Skip to content
Snippets Groups Projects

Issue #18, #19 resolved

1 file
+ 10
0
Compare changes
  • Side-by-side
  • Inline
@@ -35,5 +35,15 @@ public class PokemonRoute {
PokemonDao.INSTANCE.delete(id);
return Response.noContent().build();
}
@PUT
@Path("/{id}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Pokemon updatePokemon(@PathParam("id") String id, Pokemon updatedPokemon) {
if (id == null || !id.equals(updatedPokemon.id))
throw new BadRequestException("Id mismatch.");
return PokemonDao.INSTANCE.replace(updatedPokemon);
}
}
Loading