Fix #108 owner update

This commit is contained in:
Antoine Rey 2015-10-26 18:35:40 +01:00
parent 3bcf84543e
commit dd552f4970

View file

@ -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}";
} }