Esempio n. 1
0
 @RequestMapping(value = "/board/{id}/comments.json", method = RequestMethod.POST)
 public @ResponseBody Comment createAndShow(@PathVariable Long id, String contents) {
   log.debug("board id : {}, contents : {}", id, contents);
   Board board = boardRepository.findOne(id);
   Comment comment = new Comment(contents, board);
   return commentRepository.save(comment);
 }
Esempio n. 2
0
 @RequestMapping(value = "/board/{id}/comments", method = RequestMethod.POST)
 public String create(@PathVariable Long id, String contents) {
   log.debug("board id : {}, contents : {}", id, contents);
   Board board = boardRepository.findOne(id);
   Comment comment = new Comment(contents, board);
   commentRepository.save(comment);
   return "redirect:/board";
 }