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

Last change on this file since 89438a3 was 3242ef4, checked in by milamihajlovska <mila.mihajlovska01@…>, 22 months ago

ticket service save method

  • Property mode set to 100644
File size: 955 bytes
Line 
1package com.example.moviezone.service.Impl;
2
3import com.example.moviezone.model.Customer;
4import com.example.moviezone.model.Ticket;
5import com.example.moviezone.repository.TicketRepository;
6import com.example.moviezone.service.TicketService;
7import org.springframework.stereotype.Service;
8
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 save(long price, Customer customer) {
31 return ticketRepository.save(new Ticket(price,customer));
32 }
33}
Note: See TracBrowser for help on using the repository browser.