source: src/main/java/com/example/moviezone/service/Impl/TicketServiceImpl.java@ 4173acf

Last change on this file since 4173acf was 1e7126f, checked in by DenicaKj <dkorvezir@…>, 15 months ago

fix

  • Property mode set to 100644
File size: 1.6 KB
Line 
1package com.example.moviezone.service.Impl;
2
3import com.example.moviezone.model.*;
4import com.example.moviezone.repository.TicketRepository;
5import com.example.moviezone.service.TicketService;
6import org.springframework.stereotype.Service;
7
8import java.time.LocalDate;
9import java.util.List;
10
11@Service
12public class TicketServiceImpl implements TicketService {
13 private final TicketRepository ticketRepository;
14
15 public TicketServiceImpl(TicketRepository ticketRepository) {
16 this.ticketRepository = ticketRepository;
17 }
18
19 @Override
20 public List<Ticket> findAllTickets() {
21 return ticketRepository.findAll();
22 }
23
24 @Override
25 public List<Ticket> findAllByCustomer(Customer customer) {
26 return ticketRepository.findAllByCustomer(customer);
27 }
28
29 @Override
30 public Ticket saveWithDiscount(LocalDate date, Customer customer, Projection projection, Discount discount, Seat seat) {
31 Ticket t=new Ticket(date,customer,projection,discount,seat);
32 return ticketRepository.save(t);
33 }
34
35 @Override
36 public Ticket saveWithout(LocalDate date, Customer customer, Projection projection, Seat seat) {
37 Ticket t=new Ticket(date,customer,projection,seat);
38 return ticketRepository.save(t);
39 }
40
41 @Override
42 public Ticket save(long price, Customer customer) {
43 return ticketRepository.save(new Ticket(price,customer));
44 }
45
46 @Override
47 public Integer priceForTicket(int id) {
48 return ticketRepository.getPriceForTicket(id);
49 }
50
51 @Override
52 public void delete(int id) {
53 ticketRepository.deleteById(id);
54 }
55}
Note: See TracBrowser for help on using the repository browser.