Last change
on this file since fc448f5 was eb5426c, checked in by DenicaKj <dkorvezir@…>, 22 months ago |
Home Page
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | package com.example.moviezone.service.Impl;
|
---|
2 |
|
---|
3 | import com.example.moviezone.model.Film;
|
---|
4 | import com.example.moviezone.model.Projection;
|
---|
5 | import com.example.moviezone.repository.FilmRepository;
|
---|
6 | import com.example.moviezone.repository.ProjectionRepository;
|
---|
7 | import com.example.moviezone.service.ProjectionService;
|
---|
8 | import org.springframework.stereotype.Service;
|
---|
9 |
|
---|
10 | import java.time.LocalDate;
|
---|
11 | import java.util.List;
|
---|
12 |
|
---|
13 | @Service
|
---|
14 | public class ProjectionServiceImpl implements ProjectionService {
|
---|
15 | private final ProjectionRepository projectionRepository;
|
---|
16 | private final FilmRepository filmRepository;
|
---|
17 | public ProjectionServiceImpl(ProjectionRepository projectionRepository, FilmRepository filmRepository) {
|
---|
18 | this.projectionRepository = projectionRepository;
|
---|
19 | this.filmRepository = filmRepository;
|
---|
20 | }
|
---|
21 |
|
---|
22 | @Override
|
---|
23 | public List<Projection> findAllProjections() {
|
---|
24 | return projectionRepository.findAll();
|
---|
25 | }
|
---|
26 |
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | public Projection save(LocalDate date_time_start, LocalDate date_time_end, String type_of_technology, Integer id_film) {
|
---|
30 | Film film=filmRepository.findById(id_film).orElseThrow(RuntimeException::new);
|
---|
31 | return projectionRepository.save(new Projection(date_time_start,type_of_technology,date_time_end,film));
|
---|
32 | }
|
---|
33 |
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.