source: src/main/java/com/example/moviezone/service/Impl/CustomerRatesFilmImpl.java@ 608fba87

Last change on this file since 608fba87 was 73f0dbc, checked in by DenicaKj <dkorvezir@…>, 21 months ago

added rating

  • Property mode set to 100644
File size: 1017 bytes
Line 
1package com.example.moviezone.service.Impl;
2
3import com.example.moviezone.model.manytomany.CustomerRatesFilm;
4import com.example.moviezone.repository.CustomerRatesFilmRepository;
5import com.example.moviezone.service.CustomerRatesFilmService;
6import org.springframework.stereotype.Service;
7
8@Service
9public class CustomerRatesFilmImpl implements CustomerRatesFilmService {
10 private final CustomerRatesFilmRepository customerRatesFilmRepository;
11
12 public CustomerRatesFilmImpl(CustomerRatesFilmRepository customerRatesFilmRepository) {
13 this.customerRatesFilmRepository = customerRatesFilmRepository;
14 }
15
16 @Override
17 public double avg_rating(int id) {
18 return customerRatesFilmRepository.avg_rating(id);
19 }
20
21 @Override
22 public CustomerRatesFilm addRating(Integer id_customer, Integer id_film, double rating) {
23 CustomerRatesFilm customerRatesFilm=new CustomerRatesFilm(id_customer,id_film,rating);
24 return customerRatesFilmRepository.save(customerRatesFilm);
25 }
26}
Note: See TracBrowser for help on using the repository browser.