Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/controller/UserController.java
re02787e r2a552fe 25 25 private final UserService userService; 26 26 private final CarService carService; 27 private final CarSampleRepository carSampleRepository;28 private final ServiceBookRepository serviceBookRepository;29 27 private final RepairService repairService; 30 28 private final ReviewRepository reviewRepository; 31 private final RepairRepository repairRepository;32 29 private final OrderRepository orderRepository; 33 30 34 public UserController(OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository, UserService userService, CarService carService, CarSampleRepository carSampleRepository, ServiceBookRepository serviceBookRepository, RepairService repairService, ReviewRepository reviewRepository, 35 RepairRepository repairRepository, 31 public UserController(OrdersForUserRepository ordersForUserRepository, RepairsForUserRepository repairsForUserRepository, ReviewsForUserRepository reviewsForUserRepository, UserService userService, CarService carService, RepairService repairService, ReviewRepository reviewRepository, 36 32 OrderRepository orderRepository) { 37 33 this.ordersForUserRepository = ordersForUserRepository; … … 40 36 this.userService = userService; 41 37 this.carService = carService; 42 this.carSampleRepository = carSampleRepository;43 this.serviceBookRepository = serviceBookRepository;44 38 this.repairService = repairService; 45 39 this.reviewRepository = reviewRepository; 46 this.repairRepository = repairRepository;47 40 this.orderRepository = orderRepository; 48 41 } … … 92 85 @RequestParam Integer km, @RequestParam Integer cartype, 93 86 HttpServletRequest request, HttpServletResponse response){ 94 CarSample cs = new CarSample(vin,year,power,displacement,fuel,km, (Client) userService.findByUsername(request.getRemoteUser()),carService.findById(cartype)); 95 carSampleRepository.save(cs); 96 serviceBookRepository.save(new ServiceBook(cs)); 87 userService.addCarSampleForUser(vin,year,power,displacement,fuel,km,cartype,request.getRemoteUser()); 97 88 try { 98 89 response.sendRedirect("/"); … … 109 100 @PostMapping("/repairs/addReview/{id}") 110 101 public void addReview(@PathVariable Integer id, @RequestParam Integer rating, @RequestParam(required = false) String comment, 111 Model model,HttpServletResponse response, HttpServletRequest request){102 HttpServletResponse response, HttpServletRequest request){ 112 103 Client client = (Client) userService.findByUsername(request.getRemoteUser()); 113 104 Repair repair = repairService.findById(id);
Note:
See TracChangeset
for help on using the changeset viewer.