コード例 #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
 public Restaurant updateRestaurant(@RequestBody Restaurant restaurant) {
   restaurantRepository.save(restaurant);
   return restaurant;
 }
コード例 #2
0
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
 @ResponseStatus(value = HttpStatus.OK)
 public void deleteRestaurant(@PathVariable Long id) {
   Restaurant r = restaurantRepository.findOne(id);
   restaurantRepository.delete(r);
 }
コード例 #3
0
 @RequestMapping(method = RequestMethod.POST)
 @ResponseStatus(value = HttpStatus.CREATED)
 public Restaurant addRestaurant(@RequestBody Restaurant restaurant) {
   restaurantRepository.save(restaurant);
   return restaurant;
 }