готово

This commit is contained in:
maxnes3 2023-05-15 22:05:28 +04:00
parent 72128f189c
commit 9df9926503
3 changed files with 4 additions and 2 deletions

View File

@ -55,7 +55,7 @@ public class AuthorMvcController {
}
authorDto.setPhoto("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
if (id == null || id <= 0) {
authorService.addAuthor(authorDto);
return "redirect:/author/" + authorService.addAuthor(authorDto).getId().toString() + "/books";
} else {
authorService.updateAuthor(id, authorDto);
}

View File

@ -1,5 +1,6 @@
package ru.ip.labworks.labworks.bookshop.controller;
import org.springframework.format.annotation.DateTimeFormat;
import ru.ip.labworks.labworks.bookshop.model.Book;
import java.nio.charset.StandardCharsets;
@ -8,6 +9,7 @@ import java.util.Date;
public class BookDto {
private Long id;
private String name;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date release;
private String cover;

View File

@ -54,7 +54,7 @@ public class BookMvcController {
}
bookDto.setCover("data:" + multipartFile.getContentType() + ";base64," + Base64.getEncoder().encodeToString(multipartFile.getBytes()));
if (id == null || id <= 0) {
bookService.addBook(bookDto);
return "redirect:/book/" + bookService.addBook(bookDto).getId().toString() + "/genres";
} else {
bookService.updateBook(id, bookDto);
}