mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:25:50 +00:00
Fix #108 owner update
This commit is contained in:
parent
3bcf84543e
commit
dd552f4970
1 changed files with 2 additions and 1 deletions
|
@ -111,10 +111,11 @@ public class OwnerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/owners/{ownerId}/edit", method = RequestMethod.POST)
|
@RequestMapping(value = "/owners/{ownerId}/edit", method = RequestMethod.POST)
|
||||||
public String processUpdateOwnerForm(@Valid Owner owner, BindingResult result) {
|
public String processUpdateOwnerForm(@Valid Owner owner, @PathVariable("ownerId") int ownerId, BindingResult result) {
|
||||||
if (result.hasErrors()) {
|
if (result.hasErrors()) {
|
||||||
return "owners/createOrUpdateOwnerForm";
|
return "owners/createOrUpdateOwnerForm";
|
||||||
} else {
|
} else {
|
||||||
|
owner.setId(ownerId);
|
||||||
this.clinicService.saveOwner(owner);
|
this.clinicService.saveOwner(owner);
|
||||||
return "redirect:/owners/{ownerId}";
|
return "redirect:/owners/{ownerId}";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue