- Timestamp:
- 02/08/23 11:18:57 (22 months ago)
- Branches:
- master
- Children:
- afa6544
- Parents:
- 93341f8 (diff), 64ee7f4 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
r93341f8 r89438a3 4 4 import com.example.moviezone.model.*; 5 5 import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException; 6 6 7 import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom; 7 8 import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository; 9 10 import com.example.moviezone.model.procedures.FilmsReturnTable; 11 8 12 import com.example.moviezone.service.*; 9 13 import org.springframework.format.annotation.DateTimeFormat; … … 14 18 import javax.servlet.http.HttpSession; 15 19 import java.time.LocalDate; 20 import java.util.LinkedList; 16 21 import java.util.List; 17 22 import java.util.stream.Collectors; … … 31 36 private final CinemaOrganizesEventService cinemaOrganizesEventService; 32 37 private final CinemaPlaysFilmService cinemaPlaysFilmService; 33 private final ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository; 34 35 36 public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository) { 38 private final ProjectionIsPlayedInRoomService projectionIsPlayedInRoomService; 39 40 41 public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository) 42 { 37 43 38 44 this.filmService = filmService; … … 46 52 this.cinemaOrganizesEventService = cinemaOrganizesEventService; 47 53 this.cinemaPlaysFilmService = cinemaPlaysFilmService; 48 this.projectionIsPlayedInRoom Repository = projectionIsPlayedInRoomRepository;54 this.projectionIsPlayedInRoomService = projectionIsPlayedInRoomService; 49 55 } 50 56 … … 127 133 128 134 } 129 130 135 @GetMapping("/films") 131 136 public String getFilmsPage(Model model){ 132 137 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 133 model.addAttribute("films",filmService.findAllFilms()); 138 List<FilmsReturnTable> pom=new LinkedList<>(); 139 model.addAttribute("films",pom); 140 boolean h=pom.isEmpty(); 141 List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2); 134 142 model.addAttribute("bodyContent","films"); 135 143 return "master-template"; 136 144 } 137 145 146 public String getFilmsPage1(Model model,Integer id_cinema){ 147 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 148 if (id_cinema!=null) { 149 model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema.intValue())); 150 }else{ 151 List<FilmsReturnTable> pom=new LinkedList<>(); 152 model.addAttribute("films",pom); 153 } 154 155 model.addAttribute("bodyContent","films"); 156 return "master-template"; 157 } 158 @PostMapping("/getFilmsFromCinema") 159 public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){ 160 return getFilmsPage1(model,cinema); 161 } 138 162 @GetMapping("/projections") 139 163 public String getProjectionsPage(Model model) … … 262 286 263 287 264 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoom Repository.findAllById_projection(id_projection);288 List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomService.getProjectionPlayedInRoom(id_projection); 265 289 266 290 model.addAttribute("projection",projection);
Note:
See TracChangeset
for help on using the changeset viewer.