готово
This commit is contained in:
parent
72128f189c
commit
9df9926503
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user