Changeset c3278ac for Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PetController.java
- Timestamp:
- 03/09/23 16:11:48 (16 months ago)
- Branches:
- main
- Children:
- 0078d84, 4ab3aae
- Parents:
- 8b7dd7f (diff), 264d675 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - git-author:
- SazdovaEkaterina <74919977+SazdovaEkaterina@…> (03/09/23 16:11:48)
- git-committer:
- GitHub <noreply@…> (03/09/23 16:11:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Prototype Application/Paw5/src/main/java/finki/paw5/web/controllers/PetController.java
r8b7dd7f rc3278ac 1 1 package finki.paw5.web.controllers; 2 2 3 import finki.paw5.model.entities.Adopter; 3 4 import finki.paw5.model.entities.Adoption; 4 5 import finki.paw5.model.entities.Pet; 5 import finki.paw5.model.entities.User;6 import finki.paw5.model.exceptions.InvalidPetIdException;7 6 import finki.paw5.service.AdoptionService; 8 7 import finki.paw5.service.PetService; … … 25 24 } 26 25 27 @PostMapping("/submit-adopt on-{id}")26 @PostMapping("/submit-adoption-{id}") 28 27 public String saveAdoption(@PathVariable Integer id, HttpServletRequest request) { 29 28 30 29 Pet pet = this.petService.findById(id); 31 30 32 User user = (User) request.getSession().getAttribute("user");31 Adopter adopter = (Adopter) request.getSession().getAttribute("user"); 33 32 34 Adoption adoption = new Adoption(LocalDate.now(), null, false, user.getId());33 Adoption adoption = new Adoption(LocalDate.now(), null, false, adopter); 35 34 this.adoptionService.save(adoption); 36 35 37 pet.setAdoption Id(adoption.getId());36 pet.setAdoption(adoption); 38 37 this.petService.save(pet); 39 38
Note:
See TracChangeset
for help on using the changeset viewer.