@RequestMapping("/carRecords") public String records(ModelMap model) { RecordsDTO recordDTO = new RecordsDTO(); recordDTO.setRecords(fuelDAO.getAll()); model.addAttribute("form", recordDTO); return "carRecords"; }
@RequestMapping("/editRecordResult") public String editRecordResult( ModelMap model, @ModelAttribute("editRecordDTO") EditRecordDTO editRecordDTO) { Fuel fuel = editRecordDTO.getNewFuel(); fuelDAO.update(fuel); RecordsDTO recordDTO = new RecordsDTO(); recordDTO.setRecords(fuelDAO.getAll()); model.addAttribute("form", recordDTO); return "carRecords"; }
@RequestMapping("/carRemoveRecord") public String removeRecord( ModelMap model, HttpServletRequest request, HttpServletResponse response) { int id = Integer.parseInt(request.getParameter("id")); fuelDAO.removeById(id); RecordsDTO recordDTO = new RecordsDTO(); recordDTO.setRecords(fuelDAO.getAll()); model.addAttribute("form", recordDTO); return "carRecords"; }