@RequestMapping(value = DELETE_USER_MAPPING, method = RequestMethod.POST) public ModelAndView deleteUser(@RequestParam @ModelAttribute long userId) { bookingFacade.deleteUser(userId); ModelAndView modelAndView = new ModelAndView(UserView.DELETE_USER); return modelAndView; }
@RequestMapping(value = GET_USERS_BY_NAME_MAPPING, method = RequestMethod.GET) public ModelAndView getUsersByName(@RequestParam String name) { List<User> users = bookingFacade.getUsersByName(name); ModelAndView modelAndView = new ModelAndView(UserView.USERS); modelAndView.addObject("users", users); return modelAndView; }
@RequestMapping(value = GET_USER_BY_EMAIL_MAPPING, method = RequestMethod.GET) public ModelAndView getUserByEmail(@RequestParam String email) { User user = bookingFacade.getUserByEmail(email); ModelAndView modelAndView = new ModelAndView(UserView.USER); modelAndView.addObject("user", user); return modelAndView; }
@RequestMapping(value = GET_USER_BY_ID_MAPPING, method = RequestMethod.GET) public ModelAndView getUserById(@RequestParam long userId) { User user = bookingFacade.getUserById(userId); ModelAndView modelAndView = new ModelAndView(UserView.USER); modelAndView.addObject("user", user); return modelAndView; }
@RequestMapping(value = REGISTER_USER_MAPPING, method = RequestMethod.POST) public ModelAndView registerUser( @RequestParam String name, @RequestParam String email, @RequestParam Date dateOfBirth) { User registeredUser = bookingFacade.registerUser(name, email, dateOfBirth); ModelAndView modelAndView = new ModelAndView(UserView.REGISTER_USER); modelAndView.addObject("user", registeredUser); return modelAndView; }