@RequestMapping(value = "/rooms") public ModelAndView showRooms() { ModelAndView modelAndView = new ModelAndView("room"); List<Room> rooms = RoomService.getAllRooms(); modelAndView.addObject("rooms", rooms); return modelAndView; }
@RequestMapping(value = "/deleteRoom", method = RequestMethod.POST) public @ResponseBody void deleteRoom(@RequestParam("deleteId") int deleteId) { RoomService.deleteRoomById(deleteId); }
@RequestMapping(value = "/getRoomByRoomCode", method = RequestMethod.POST) public @ResponseBody String getRoomByRoomCode(@RequestParam("roomCode") String roomCode) throws JsonProcessingException { Room room = RoomService.getRoomByRoomCode(roomCode); return JSONUtility.parseJSON(room); }
@RequestMapping(value = "/addNewRoom", method = RequestMethod.POST) public @ResponseBody void addNewRoom( HttpServletResponse response, @ModelAttribute("room") Room room) throws IOException { RoomService.addRoom(room); }