Ignore:
Timestamp:
02/04/23 21:01:13 (22 months ago)
Author:
milamihajlovska <mila.mihajlovska01@…>
Branches:
master
Children:
693f587
Parents:
a554435
Message:

home controller added mappings for add new film, event and projection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/service/Impl/ProjectionServiceImpl.java

    ra554435 r302b233  
    11package com.example.moviezone.service.Impl;
    22
     3import com.example.moviezone.model.Film;
    34import com.example.moviezone.model.Projection;
     5import com.example.moviezone.repository.FilmRepository;
    46import com.example.moviezone.repository.ProjectionRepository;
    57import com.example.moviezone.service.ProjectionService;
     
    1214public class ProjectionServiceImpl implements ProjectionService {
    1315    private final ProjectionRepository projectionRepository;
    14 
    15     public ProjectionServiceImpl(ProjectionRepository projectionRepository) {
     16    private final FilmRepository filmRepository;
     17    public ProjectionServiceImpl(ProjectionRepository projectionRepository, FilmRepository filmRepository) {
    1618        this.projectionRepository = projectionRepository;
     19        this.filmRepository = filmRepository;
    1720    }
    1821
     
    2730    }
    2831
     32    @Override
     33    public Projection save(LocalDate date_time_start, LocalDate date_time_end, String type_of_technology, Integer id_film) {
     34       Film film=filmRepository.findById(id_film).orElseThrow(RuntimeException::new);
     35        return projectionRepository.save(new Projection(date_time_start,type_of_technology,date_time_end,film));
     36    }
     37
    2938}
Note: See TracChangeset for help on using the changeset viewer.