Changeset ef84238 for src/main/java/com/example/moviezone/web
- Timestamp:
- 02/10/23 11:18:48 (23 months ago)
- Branches:
- master
- Children:
- 04153a9
- Parents:
- 7926d68
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
r7926d68 ref84238 24 24 import java.util.LinkedList; 25 25 import java.util.List; 26 import java.util.Objects;27 26 import java.util.stream.Collectors; 28 27 … … 46 45 private final CustomerService customerService; 47 46 private final Projection_RoomService projectionRoomService; 48 49 public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService, CategoryService categoryService, SeatService seatService, CustomerService customerService, Projection_RoomService projectionRoomService) 47 private final CustomerIsInterestedInEventService customerIsInterestedInEventService; 48 49 public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService, CategoryService categoryService, SeatService seatService, CustomerService customerService, Projection_RoomService projectionRoomService, CustomerIsInterestedInEventService customerIsInterestedInEventService) 50 50 { 51 51 … … 65 65 this.customerService = customerService; 66 66 this.projectionRoomService = projectionRoomService; 67 this.customerIsInterestedInEventService = customerIsInterestedInEventService; 67 68 } 68 69 … … 412 413 } 413 414 @GetMapping("/profileUser") 415 @Transactional 414 416 public String getUserProfile(Model model,HttpServletRequest request) 415 417 { 416 418 Customer customer=customerService.findByUsername(request.getRemoteUser()); 417 419 System.out.println(customer.getFirst_name()); 420 List<Event> events=eventService.getEventsForCustomer(customer.getId_user()); 418 421 model.addAttribute("customer",customer); 422 model.addAttribute("events",events); 419 423 model.addAttribute("bodyContent", "profileUser"); 420 424 return "master-template"; 421 425 } 426 @PostMapping("/addInterestedEvent/{id}") 427 public String addInterestedEvent(@PathVariable Long id,HttpServletRequest request, HttpServletResponse respons) 428 { 429 Customer customer=customerService.findByUsername(request.getRemoteUser()); 430 customerIsInterestedInEventService.add(customer.getId_user(),Integer.valueOf(id.intValue())); 431 return "redirect:/profileUser"; 432 } 433 @PostMapping("/deleteInterestedEvent/{id}") 434 public String deleteInterestedEvent(@PathVariable Long id,HttpServletRequest request, HttpServletResponse respons) 435 { 436 Customer customer=customerService.findByUsername(request.getRemoteUser()); 437 Event event=eventService.getEventById(id).get(); 438 customerIsInterestedInEventService.delete(customer,event); 439 return "redirect:/profileUser"; 440 } 422 441 }
Note:
See TracChangeset
for help on using the changeset viewer.