Changeset fc448f5 for src/main/java


Ignore:
Timestamp:
02/07/23 14:21:14 (23 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
03fd098
Parents:
d7f5da9
Message:

cinemaOrganizesEvent 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/CinemaOrganizesEvent.java

    rd7f5da9 rfc448f5  
    2828    @Id
    2929    Integer id_event;
     30
     31    public CinemaOrganizesEvent(Integer id_cinema, Integer id_event) {
     32        this.id_cinema=id_cinema;
     33        this.id_event=id_event;
     34    }
    3035}
  • src/main/java/com/example/moviezone/web/HomeController.java

    rd7f5da9 rfc448f5  
    44import com.example.moviezone.model.*;
    55import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
    6 import com.example.moviezone.model.exceptions.UserNotFoundException;
    76import com.example.moviezone.service.*;
    87import org.springframework.format.annotation.DateTimeFormat;
     
    2726private final WorkerService workerService;
    2827private final CustomerRatesFilmService customerRatesFilmService;
    29 
    30     public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService) {
     28private final CinemaService cinemaService;
     29private 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) {
    3132        this.filmService = filmService;
    3233        this.userService = userService;
     
    3637        this.workerService = workerService;
    3738        this.customerRatesFilmService = customerRatesFilmService;
     39        this.cinemaService = cinemaService;
     40        this.cinemaOrganizesEventService = cinemaOrganizesEventService;
    3841    }
    3942
     
    152155        return "master-template";
    153156    }
     157
     158
    154159    @GetMapping("/addEvent")
    155160    public  String getAddEventPage(Model model)
     
    208213        return "master-template";
    209214    }
     215
     216    @GetMapping("/addEventToCinema")
     217    public  String getCinemaOrganizesEventPage(Model model)
     218    {
     219        model.addAttribute("cinemas",cinemaService.findAllCinemas());
     220        model.addAttribute("events",eventService.findAllEvents());
     221        model.addAttribute("bodyContent","addEventToCinema");
     222        return "master-template";
     223    }
     224    @PostMapping("/addCinemaOrganizesEvent")
     225    public String saveCinemaOrganizesEvent(@RequestParam Integer id_cinema,
     226                                           @RequestParam Integer id_event)
     227    {
     228
     229       cinemaOrganizesEventService.save(id_cinema,id_event);
     230        return "redirect:/home";
     231    }
     232
    210233}
Note: See TracChangeset for help on using the changeset viewer.