Changeset 8d49568 for src/main/java/com/example/moviezone/web
- Timestamp:
- 02/07/23 23:14:46 (23 months ago)
- Branches:
- master
- Children:
- 64ee7f4
- Parents:
- cb5debb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/web/HomeController.java
rcb5debb r8d49568 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; … … 35 40 36 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) { 37 42 38 43 this.filmService = filmService; 39 44 this.userService = userService; … … 127 132 128 133 } 129 130 134 @GetMapping("/films") 131 135 public String getFilmsPage(Model model){ 132 136 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 133 model.addAttribute("films",filmService.findAllFilms()); 137 List<FilmsReturnTable> pom=new LinkedList<>(); 138 model.addAttribute("films",pom); 139 boolean h=pom.isEmpty(); 140 List<FilmsReturnTable> help=filmService.getFilmsFromCinema(2); 134 141 model.addAttribute("bodyContent","films"); 135 142 return "master-template"; 136 143 } 137 144 145 public String getFilmsPage1(Model model,Integer id_cinema){ 146 model.addAttribute("cinemas",cinemaService.findAllCinemas()); 147 if (id_cinema!=null) { 148 model.addAttribute("films",filmService.getFilmsFromCinema(id_cinema.intValue())); 149 }else{ 150 List<FilmsReturnTable> pom=new LinkedList<>(); 151 model.addAttribute("films",pom); 152 } 153 154 model.addAttribute("bodyContent","films"); 155 return "master-template"; 156 } 157 @PostMapping("/getFilmsFromCinema") 158 public String getFilmsFromCinema(@RequestParam Integer cinema, Model model){ 159 return getFilmsPage1(model,cinema); 160 } 138 161 @GetMapping("/projections") 139 162 public String getProjectionsPage(Model model)
Note:
See TracChangeset
for help on using the changeset viewer.