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

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

fix

  • Property mode set to 100644
File size: 1.6 KB
RevLine 
[11dea8f]1package com.example.moviezone.service.Impl;
2
[00fa72f]3import com.example.moviezone.model.*;
[1b248e4]4import com.example.moviezone.repository.TicketRepository;
[11dea8f]5import com.example.moviezone.service.TicketService;
6import org.springframework.stereotype.Service;
7
[00fa72f]8import java.time.LocalDate;
[11dea8f]9import java.util.List;
10
11@Service
12public class TicketServiceImpl implements TicketService {
[1b248e4]13 private final TicketRepository ticketRepository;
14
15 public TicketServiceImpl(TicketRepository ticketRepository) {
16 this.ticketRepository = ticketRepository;
17 }
18
[11dea8f]19 @Override
20 public List<Ticket> findAllTickets() {
[1b248e4]21 return ticketRepository.findAll();
[11dea8f]22 }
23
24 @Override
[1b248e4]25 public List<Ticket> findAllByCustomer(Customer customer) {
26 return ticketRepository.findAllByCustomer(customer);
[11dea8f]27 }
[3242ef4]28
[00fa72f]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
[3242ef4]41 @Override
42 public Ticket save(long price, Customer customer) {
43 return ticketRepository.save(new Ticket(price,customer));
44 }
[00fa72f]45
46 @Override
47 public Integer priceForTicket(int id) {
48 return ticketRepository.getPriceForTicket(id);
49 }
[1e7126f]50
51 @Override
52 public void delete(int id) {
53 ticketRepository.deleteById(id);
54 }
[11dea8f]55}
Note: See TracBrowser for help on using the repository browser.