@RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Tag updateTag(@RequestBody Tag updatedTag, @PathVariable Long id) { Tag tag = tagDao.getTagById(id); tag.setName(updatedTag.getName()); tag.setItemCount(tag.getItemCount() + 1); return tagDao.modifyTag(tag); }
@RequestMapping(method = RequestMethod.POST) @ResponseStatus(value = HttpStatus.CREATED) public Tag addTag(@RequestBody Tag tag) { tag.setId(null); return tagDao.newTag(tag); }