mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
985 remove lastName method param from OwnerController
This commit is contained in:
parent
2a12048e78
commit
80d03f3cef
1 changed files with 3 additions and 5 deletions
|
@ -96,8 +96,7 @@ class OwnerController {
|
|||
}
|
||||
|
||||
// find owners by last name
|
||||
String lastName = owner.getLastName();
|
||||
Page<Owner> ownersResults = findPaginatedForOwnersLastName(page, lastName);
|
||||
Page<Owner> ownersResults = findPaginatedForOwnersLastName(page, owner.getLastName());
|
||||
if (ownersResults.isEmpty()) {
|
||||
// no owners found
|
||||
result.rejectValue("lastName", "notFound", "not found");
|
||||
|
@ -110,12 +109,11 @@ class OwnerController {
|
|||
}
|
||||
else {
|
||||
// multiple owners found
|
||||
lastName = owner.getLastName();
|
||||
return addPaginationModel(page, model, lastName, ownersResults);
|
||||
return addPaginationModel(page, model, ownersResults);
|
||||
}
|
||||
}
|
||||
|
||||
private String addPaginationModel(int page, Model model, String lastName, Page<Owner> paginated) {
|
||||
private String addPaginationModel(int page, Model model, Page<Owner> paginated) {
|
||||
model.addAttribute("listOwners", paginated);
|
||||
List<Owner> listOwners = paginated.getContent();
|
||||
model.addAttribute("currentPage", page);
|
||||
|
|
Loading…
Reference in a new issue