Changeset 9eba1fb for src


Ignore:
Timestamp:
02/07/23 15:27:23 (22 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
cb5debb
Parents:
fdc651c
Message:

reservation for projection started

Location:
src/main
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/repository/ProjectionIsPlayedInRoomRepository.java

    rfdc651c r9eba1fb  
    55import org.springframework.data.jpa.repository.JpaRepository;
    66
     7import java.util.List;
     8
    79public interface ProjectionIsPlayedInRoomRepository extends JpaRepository<ProjectionIsPlayedInRoom, ProjectionIsPlayedInRoomId> {
     10    List<ProjectionIsPlayedInRoom> findAllById_projection(Integer id_projection);
    811}
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    rfdc651c r9eba1fb  
    2525    }
    2626
     27    @Override
     28    public Projection findById(Integer id_projection) {
     29        return projectionRepository.findById(id_projection).orElseThrow(RuntimeException::new);
     30    }
     31
    2732
    2833    @Override
  • src/main/java/com/example/moviezone/service/ProjectionService.java

    rfdc651c r9eba1fb  
    99public interface ProjectionService {
    1010    List<Projection> findAllProjections();
     11    Projection findById(Integer id_projection);
    1112Projection save(LocalDate date_time_start,LocalDate date_time_end, String type_of_technology, Integer id_film );
    1213}
  • src/main/java/com/example/moviezone/web/HomeController.java

    rfdc651c r9eba1fb  
    44import com.example.moviezone.model.*;
    55import com.example.moviezone.model.exceptions.PasswordsDoNotMatchException;
     6import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
     7import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
    68import com.example.moviezone.service.*;
    79import org.springframework.format.annotation.DateTimeFormat;
     
    2931private final CinemaOrganizesEventService cinemaOrganizesEventService;
    3032private 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) {
     33private final ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository;
     34
     35    public HomeController(FilmService filmService, UserService userService, ProjectionService projectionService, EventService eventService, TicketService ticketService, WorkerService workerService, CustomerRatesFilmService customerRatesFilmService, CinemaService cinemaService, CinemaOrganizesEventService cinemaOrganizesEventService, CinemaPlaysFilmService cinemaPlaysFilmService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository) {
    3336        this.filmService = filmService;
    3437        this.userService = userService;
     
    4144        this.cinemaOrganizesEventService = cinemaOrganizesEventService;
    4245        this.cinemaPlaysFilmService = cinemaPlaysFilmService;
     46        this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository;
    4347    }
    4448
     
    247251        return "redirect:/home";
    248252    }
     253
     254    @GetMapping("/getProjection/{id}")
     255    public String getProjection(@PathVariable Integer id_projection,Model model)
     256    {
     257        List<Projection_Room> projectionRooms = null;
     258        Projection projection=projectionService.findById(id_projection);
     259
     260
     261        List<ProjectionIsPlayedInRoom> p= projectionIsPlayedInRoomRepository.findAllById_projection(id_projection);
     262
     263        model.addAttribute("projection",projection);
     264        model.addAttribute("p_rooms",projectionRooms);
     265        model.addAttribute("bodyContent","projectionDetails");
     266        return "master-template";
     267    }
     268
     269    @PostMapping("/makeReservation")
     270    public String createTicketForReservation()
     271    {
     272        return "redirect:/myTickets";
     273    }
     274
    249275}
Note: See TracChangeset for help on using the changeset viewer.