Changeset f8007b3 for src/main/java/it
- Timestamp:
- 09/03/21 11:34:33 (3 years ago)
- Branches:
- master
- Children:
- 194776a
- Parents:
- f0d5cb7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/controller/UserProfileController.java
rf0d5cb7 rf8007b3 1 1 package it.finki.charitable.controller; 2 2 3 import it.finki.charitable.entities.AppUser; 4 import it.finki.charitable.entities.DonationInformation; 5 import it.finki.charitable.entities.DonationPost; 6 import it.finki.charitable.entities.MainUser; 3 import it.finki.charitable.entities.*; 7 4 import it.finki.charitable.security.PasswordEncoder; 8 5 import it.finki.charitable.services.DonationPostService; 6 import it.finki.charitable.services.FundsCollectedService; 9 7 import it.finki.charitable.services.UserService; 10 8 import org.springframework.security.core.context.SecurityContextHolder; … … 23 21 private final UserService userService; 24 22 private final DonationPostService donationPostService; 23 private final FundsCollectedService fundsCollectedService; 25 24 26 public UserProfileController(UserService userService, DonationPostService donationPostService ) {25 public UserProfileController(UserService userService, DonationPostService donationPostService, FundsCollectedService fundsCollectedService) { 27 26 this.userService = userService; 28 27 this.donationPostService = donationPostService; 28 this.fundsCollectedService = fundsCollectedService; 29 29 } 30 30 … … 105 105 } 106 106 107 @RequestMapping("/addFunds") 108 public String addFunds(@RequestParam Long postid, 109 @RequestParam String type, 110 @RequestParam float amount) { 111 112 DonationPost post = donationPostService.getById(postid); 113 FundsCollected funds = new FundsCollected(type, amount); 114 fundsCollectedService.save(funds); 115 116 post.getFundsCollected().add(funds); 117 donationPostService.save(post); 118 return "redirect:/myPosts"; 119 } 120 107 121 @ModelAttribute("user") 108 122 public AppUser addAttributes() {
Note:
See TracChangeset
for help on using the changeset viewer.