Search in sources :

Example 6 with Watchlist

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;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) WatchlistForm(com.cassandrawebtrader.dto.WatchlistForm) Watchlist(com.cassandrawebtrader.domain.Watchlist) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 7 with Watchlist

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";
}
Also used : Watchlist(com.cassandrawebtrader.domain.Watchlist) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Watchlist (com.cassandrawebtrader.domain.Watchlist)7 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 WatchlistForm (com.cassandrawebtrader.dto.WatchlistForm)2 List (java.util.List)2 Scheduled (org.springframework.scheduling.annotation.Scheduled)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1