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

Location:
src/main/java/com/example/moviezone/service/Impl
Files:
3 edited

Legend:

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

    ra554435 r302b233  
    66import org.springframework.stereotype.Service;
    77
     8import java.time.LocalDate;
    89import java.util.List;
    910
     
    2021        return eventRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Event save(LocalDate start_date, String theme, String duration, String repeating) {
     26        return eventRepository.save(new Event(theme,duration,repeating,start_date));
     27    }
    2228}
  • src/main/java/com/example/moviezone/service/Impl/FilmServiceImpl.java

    ra554435 r302b233  
    66import org.springframework.stereotype.Service;
    77
     8import java.time.LocalDate;
    89import java.util.List;
    910
     
    2021        return filmRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Film save(String name, Integer duration, String actors, String genre, String age_category, String url, String director, LocalDate start_date, LocalDate end_date) {
     26        return filmRepository.save(new Film(name,duration,actors,genre,age_category,url,director,start_date,end_date));
     27    }
    2228}
  • 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.