@POST @Path("{id}") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void edit( @PathParam("id") Long id, @FormParam("name") String name, @FormParam("description") String description) { Genre genre = genreManager.get(id); if (genre != null) { genreManager.update(genre, name, description); } }
@PUT @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void add(@FormParam("name") String name, @FormParam("description") String description) { Genre newGenre = new Genre(); newGenre.setName(name); newGenre.setDescription(description); genreManager.add(newGenre); }
@DELETE @Path("{id}") public void delete(@PathParam("id") Long id) { genreManager.delete(genreManager.get(id)); }
@GET @Path("{id}") public Genre get(@PathParam("id") Long id) { return genreManager.get(id); }
@GET public List<Genre> getAllGenres() { return genreManager.getAllGenres(); }