use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistController method editWatchlistPage.
@RequestMapping(value = "/edit", method = RequestMethod.GET)
public ModelAndView editWatchlistPage(@RequestParam(value = "symbol", required = true) String symbol) {
ModelAndView modelAndView = new ModelAndView("watchlist-edit");
Watchlist watchlist = watchlistRepository.findBySymbol(symbol);
WatchlistForm watchlistForm = mapper.map(watchlist);
modelAndView.addObject(watchlistForm);
return modelAndView;
}
use of com.cassandrawebtrader.domain.Watchlist in project microservices by pwillhan.
the class WatchlistController method postWatchlistPage.
@RequestMapping(value = "/edit", method = RequestMethod.POST)
public String postWatchlistPage(@ModelAttribute("watchlistForm") @Valid WatchlistForm watchlistForm, BindingResult result) {
if (result.hasErrors())
return "watchlist-edit";
Watchlist watchlist = mapper.map(watchlistForm);
watchlistRepository.save(watchlist);
return "redirect:/admin/watchlist";
}
Aggregations