Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets the platform we want to edit
- *
- * @param uuid platform.uuid
- * @param model platform
- * @return edit-platform.html
- */
- @GetMapping(path = "/get/{uuid}/edit")
- public String edit(@PathVariable String uuid, Model model) throws NumberFormatException {
- Platform platform = this.dataProvider.getPlatformByUUID(uuid);
- model.addAttribute("platform", platform);
- if (platform != null) {
- System.out.println();
- return "edit-platform";
- }
- GameManagerException customException = new GameManagerException(HttpStatus.NOT_FOUND,
- "Platform with this UUID does not exist!");
- model.addAttribute("errormessage", customException);
- return "/exception/game-manager-error.html";
- }
- /**
- * Updates the platform we want to edit
- *
- * @param uuid platform.uuid
- * @param publisher String
- * @param name string
- * @return redirect:/platform
- */
- @PostMapping(path = "/get/{uuid}/edit")
- public String update(@PathVariable String uuid,
- @RequestParam("publisher") String publisher,
- @RequestParam("name") String name) {
- Platform platform = this.dataProvider.getPlatformByUUID(uuid);
- platform.setPublisher(publisher);
- platform.setName(name);
- this.dataProvider.updatePlatform(platform);
- return "redirect:/platform";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement