コード例 #1
0
 @RequestMapping(value = "/edit/{id}", method = RequestMethod.GET)
 public ModelAndView editWishlistPage(@PathVariable Integer id) {
   ModelAndView modelAndView = new ModelAndView("edit-wishlist-form");
   Wishlist wishlist = wishlistService.getResource(id);
   modelAndView.addObject("wishlist", wishlist);
   return modelAndView;
 }
コード例 #2
0
 @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
 public ModelAndView deleteWishlist(@PathVariable Integer id) {
   ModelAndView modelAndView = new ModelAndView("home");
   wishlistService.deleteResource(id);
   String message = "Wishlist was successfully deleted.";
   modelAndView.addObject("message", message);
   return modelAndView;
 }
コード例 #3
0
  @ResponseBody
  @RequestMapping(value = "/list", method = RequestMethod.GET, produces = "application/json")
  public List<Wishlist> listOfWishlists() {
    ModelAndView modelAndView = new ModelAndView("list-of-wishlists");

    List<Wishlist> wishlists = wishlistService.getResources();
    modelAndView.addObject("wishlists", wishlists);

    return wishlists;
  }
コード例 #4
0
  @RequestMapping(value = "/add", method = RequestMethod.POST)
  public ModelAndView addingWishlist(@ModelAttribute Wishlist wishlist) {

    ModelAndView modelAndView = new ModelAndView("home");
    wishlistService.addResource(wishlist);

    String message = "Wishlist was successfully added.";
    modelAndView.addObject("message", message);

    return modelAndView;
  }
コード例 #5
0
  @RequestMapping(value = "/edit/{id}", method = RequestMethod.POST)
  public ModelAndView edditingWishlist(
      @ModelAttribute Wishlist wishlist, @PathVariable Integer id) {

    ModelAndView modelAndView = new ModelAndView("home");

    wishlistService.updateResource(wishlist);

    String message = "Wishlist was successfully edited.";
    modelAndView.addObject("message", message);

    return modelAndView;
  }