diff --git a/data.mv.db b/data.mv.db index c3014e0..ed8c9f8 100644 Binary files a/data.mv.db and b/data.mv.db differ diff --git a/src/main/java/ru/ip/labs/labs/films/controller/ActorController.java b/src/main/java/ru/ip/labs/labs/films/controller/ActorController.java index 4b18489..20fbd2e 100644 --- a/src/main/java/ru/ip/labs/labs/films/controller/ActorController.java +++ b/src/main/java/ru/ip/labs/labs/films/controller/ActorController.java @@ -32,7 +32,7 @@ public class ActorController { return new ActorDTO(actorService.addActor(actor.getName(), actor.getSurname())); } - @PatchMapping("") + @PatchMapping("/{id}") public ActorDTO updateActor(@PathVariable Long id, @RequestBody @Valid ActorDTO actor) { return new ActorDTO(actorService.updateActor(id, actor.getName(), actor.getSurname())); } diff --git a/src/main/java/ru/ip/labs/labs/films/controller/FilmMvcController.java b/src/main/java/ru/ip/labs/labs/films/controller/FilmMvcController.java index 399ac93..f076496 100644 --- a/src/main/java/ru/ip/labs/labs/films/controller/FilmMvcController.java +++ b/src/main/java/ru/ip/labs/labs/films/controller/FilmMvcController.java @@ -49,7 +49,7 @@ public class FilmMvcController { model.addAttribute("errors", bindingResult.getAllErrors()); return "films-catalog"; } - Long filmId = filmDTO.getId(); + Long filmId = id; if (id == null || id <= 0) { Film result = filmService.addFilm(filmDTO.getName()); diff --git a/src/main/java/ru/ip/labs/labs/films/dto/ActorDTO.java b/src/main/java/ru/ip/labs/labs/films/dto/ActorDTO.java index 0d800e2..fe5ec11 100644 --- a/src/main/java/ru/ip/labs/labs/films/dto/ActorDTO.java +++ b/src/main/java/ru/ip/labs/labs/films/dto/ActorDTO.java @@ -16,7 +16,6 @@ public class ActorDTO { private String name; private String surname; private String fullName; - private byte[] photo; private List films; @@ -26,7 +25,6 @@ public class ActorDTO { this.id = actor.getId(); this.name = actor.getName(); this.surname = actor.getSurname(); - this.photo = actor.getPhoto(); this.fullName = this.name + this.surname; } public ActorDTO(Long id, String name, String surname, byte[] photo) { @@ -34,16 +32,6 @@ public class ActorDTO { this.name = name; this.surname = surname; this.fullName = this.name + this.surname; - this.photo = photo; - } - - public byte[] getPhoto() { - return photo; - } - - public void setPhoto(String path) throws IOException { - File f = new File(path); - photo = Files.readAllBytes(f.toPath()); } public Long getId() { diff --git a/src/main/resources/templates/actors-catalog.html b/src/main/resources/templates/actors-catalog.html index fa306dd..64cc196 100644 --- a/src/main/resources/templates/actors-catalog.html +++ b/src/main/resources/templates/actors-catalog.html @@ -78,6 +78,9 @@ editForm.action = "/actor"; editForm.previousElementSibling.children[0].textContent = "Добавление"; editForm.children[1].children[1].textContent = "Добавить"; + + editForm.name.value = ""; + editForm.surname.value = ""; } editBtn.onclick = () => { @@ -92,6 +95,7 @@ editForm.previousElementSibling.children[0].textContent = "Изменение"; submitBtn.textContent = "Изменить"; editForm.name.value = elem.children[1].textContent; + editForm.surname.value = elem.children[2].textContent; } diff --git a/src/main/resources/templates/films-catalog.html b/src/main/resources/templates/films-catalog.html index 480e06a..d16afce 100644 --- a/src/main/resources/templates/films-catalog.html +++ b/src/main/resources/templates/films-catalog.html @@ -44,12 +44,34 @@ - + - + + + +
+
+
+ + + +