Changeset 03fd098 for src/main/java/com


Ignore:
Timestamp:
02/07/23 14:30:24 (23 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
3242ef4
Parents:
fc448f5
Message:

cinemaPlaysFilm implemented

Location:
src/main/java/com/example/moviezone
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/model/manytomany/CinemaPlaysFilm.java

    rfc448f5 r03fd098  
    3333    @Column(name = "id_film")
    3434    Integer id_film;
     35
     36    public CinemaPlaysFilm(Integer id_cinema,Integer id_film) {
     37        this.id_cinema = id_cinema;
     38        this.id_film=id_film;
     39    }
    3540}
  • src/main/java/com/example/moviezone/web/HomeController.java

    rfc448f5 r03fd098  
    2828private final CinemaService cinemaService;
    2929private final CinemaOrganizesEventService cinemaOrganizesEventService;
    30 
    31     public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService) {
     30private final CinemaPlaysFilmService cinemaPlaysFilmService;
     31
     32    public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService) {
    3233        this.filmService = filmService;
    3334        this.userService = userService;
     
    3940        this.cinemaService = cinemaService;
    4041        this.cinemaOrganizesEventService = cinemaOrganizesEventService;
     42        this.cinemaPlaysFilmService = cinemaPlaysFilmService;
    4143    }
    4244
     
    230232        return "redirect:/home";
    231233    }
    232 
     234    @GetMapping("/addFilmToCinema")
     235    public  String getCinemaPlaysFilmPage(Model model)
     236    {
     237        model.addAttribute("cinemas",cinemaService.findAllCinemas());
     238        model.addAttribute("films",filmService.findAllFilms());
     239        model.addAttribute("bodyContent","addFilmToCinema");
     240        return "master-template";
     241    }
     242    @PostMapping("/addCinemaPlaysFilm")
     243    public String saveCinemaPlaysFilm(@RequestParam Integer id_cinema,
     244                                           @RequestParam Integer id_film)
     245    {
     246        cinemaPlaysFilmService.save(id_cinema,id_film);
     247        return "redirect:/home";
     248    }
    233249}
Note: See TracChangeset for help on using the changeset viewer.