Ignore:
Timestamp:
02/08/23 11:18:57 (22 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
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.
Message:

Merge branch 'master' of https://github.com/DenicaKj/MovieZone

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/web/HomeController.java

    r93341f8 r89438a3  
    44import com.example.moviezone.model.*;
    55import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
     6
    67import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
    78import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
     9
     10import com.example.moviezone.model.procedures.FilmsReturnTable;
     11
    812import com.example.moviezone.service.*;
    913import org.springframework.format.annotation.DateTimeFormat;
     
    1418import javax.servlet.http.HttpSession;
    1519import java.time.LocalDate;
     20import java.util.LinkedList;
    1621import java.util.List;
    1722import java.util.stream.Collectors;
     
    3136private final CinemaOrganizesEventService cinemaOrganizesEventService;
    3237private 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) {
     38private 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    {
    3743
    3844        this.filmService = filmService;
     
    4652        this.cinemaOrganizesEventService = cinemaOrganizesEventService;
    4753        this.cinemaPlaysFilmService = cinemaPlaysFilmService;
    48         this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository;
     54        this.projectionIsPlayedInRoomService = projectionIsPlayedInRoomService;
    4955    }
    5056
     
    127133
    128134    }
    129 
    130135    @GetMapping("/films")
    131136    public String getFilmsPage(Model model){
    132137        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);
    134142        model.addAttribute("bodyContent","films");
    135143        return "master-template";
    136144    }
    137145
     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    }
    138162    @GetMapping("/projections")
    139163    public String getProjectionsPage(Model model)
     
    262286
    263287
    264         List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomRepository.findAllById_projection(id_projection);
     288        List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomService.getProjectionPlayedInRoom(id_projection);
    265289
    266290        model.addAttribute("projection",projection);
Note: See TracChangeset for help on using the changeset viewer.