Rev | Line | |
---|
[1e7126f] | 1 | package com.example.moviezone.service.Impl;
|
---|
| 2 |
|
---|
| 3 | import com.example.moviezone.model.Discount;
|
---|
| 4 | import com.example.moviezone.repository.DiscountRepository;
|
---|
| 5 | import com.example.moviezone.service.DiscountService;
|
---|
| 6 | import org.springframework.stereotype.Service;
|
---|
| 7 |
|
---|
| 8 | import java.time.LocalDate;
|
---|
| 9 | import java.util.List;
|
---|
| 10 |
|
---|
| 11 | @Service
|
---|
| 12 | public class DiscountServiceImpl implements DiscountService {
|
---|
| 13 | private final DiscountRepository discountRepository;
|
---|
| 14 |
|
---|
| 15 | public DiscountServiceImpl(DiscountRepository discountRepository) {
|
---|
| 16 | this.discountRepository = discountRepository;
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | @Override
|
---|
| 20 | public Discount save(String code, String type, LocalDate validity, Integer percent) {
|
---|
| 21 | return discountRepository.save(new Discount(validity,code,type,percent));
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | @Override
|
---|
| 25 | public List<Discount> getValidDiscounts() {
|
---|
| 26 | return discountRepository.getValidDiscounts();
|
---|
| 27 | }
|
---|
[40935d3] | 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.