Changeset 01a1ca6 for src/main/java/com/example/moviezone/web
- Timestamp:
- 02/10/23 00:10:41 (21 months ago)
- Branches:
- master
- Children:
- 73f0dbc
- Parents:
- 5444409
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
r5444409 r01a1ca6 259 259 } 260 260 @GetMapping("/myTickets") 261 public String getMyTicketsPage(Model model,HttpSession session) 262 { 263 model.addAttribute("tickets",ticketService.findAllByCustomer((Customer) session.getAttribute("user"))); 261 public String getMyTicketsPage(Model model,HttpServletRequest request) 262 { 263 Customer customer=customerService.findByUsername(request.getRemoteUser()); 264 model.addAttribute("tickets",ticketService.findAllByCustomer(customer)); 264 265 model.addAttribute("bodyContent","myTickets"); 265 266 return "master-template"; … … 380 381 @PostMapping("/makeReservation") 381 382 @Transactional 382 public String createTicketForReservation(@RequestParam Long film,@RequestParam Long projection,@RequestParam Long id_seat,@RequestParam String discount )383 public String createTicketForReservation(@RequestParam Long film,@RequestParam Long projection,@RequestParam Long id_seat,@RequestParam String discount,HttpServletRequest request, HttpServletResponse respons) 383 384 { 384 385 Ticket t; 386 Customer customer=customerService.findByUsername(request.getRemoteUser()); 385 387 Projection projection1=projectionService.findById(projection.intValue()); 386 388 if(projection1.getDiscount().equals(discount)){ 387 t=ticketService.saveWithDiscount(LocalDate.now(),customer Service.getCustomerById(2).get(),projection1,projection1.getDiscount(),seatService.getSeatById(id_seat.intValue()).get());389 t=ticketService.saveWithDiscount(LocalDate.now(),customer,projection1,projection1.getDiscount(),seatService.getSeatById(id_seat.intValue()).get()); 388 390 }else{ 389 t=ticketService.saveWithout(LocalDate.now(),customer Service.getCustomerById(4).get(),projection1,seatService.getSeatById(id_seat.intValue()).get());391 t=ticketService.saveWithout(LocalDate.now(),customer,projection1,seatService.getSeatById(id_seat.intValue()).get()); 390 392 } 391 393 Integer price=ticketService.priceForTicket(t.getId_ticket()); 392 394 t.setPrice(price); 393 return "redirect:/ home";395 return "redirect:/myTickets"; 394 396 } 395 397
Note:
See TracChangeset
for help on using the changeset viewer.