@RequestMapping(value = "/batch/byId") public ModelAndView batchById(@RequestParam("id") int id) { ModelAndView view = new ModelAndView("secure/batch"); view.addObject("update", true); BatchDto batchDto = batchService.findBatchById(id); view.addObject("batch", batchDto); view.addObject("ingredients", ingredientService.getIngredients()); view.addObject("batchIngredients", batchDto.getIngredients()); return view; }
@RequestMapping(value = "/ingredient/byId") public ModelAndView ingredientById(@RequestParam("id") int id) { IngredientDto ingredient = ingredientService.getIngredientById(id); ModelAndView view = new ModelAndView("secure/ingredient"); view.addObject("suppliers", supplierService.getSuppliers()); view.addObject("ingredientListItems", pullDownListService.getIngredientListItems()); view.addObject("unitOfMeasurements", pullDownListService.getUnitOfMeasurements()); view.addObject("supplierIdSelected", ingredient.getSupplierId()); view.addObject("unitOfMeasurementIdSelected", ingredient.getUnitOfMeasurement()); view.addObject("update", true); view.addObject("ingredient", ingredient); return view; }