Ignore:
Timestamp:
02/09/23 14:06:45 (21 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
6a9006d, a9ffccd
Parents:
0ba5d1a
Message:

Reservation Implemented

Location:
src/main/java/com/example/moviezone/service/Impl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/service/Impl/CategoryServiceImpl.java

    r0ba5d1a r00fa72f  
    77
    88import java.util.List;
     9import java.util.Optional;
    910
    1011@Service
     
    2021        return categoryRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Optional<Category> getCategoryById(int id) {
     26        return categoryRepository.getByIdcategory(id);
     27    }
    2228}
  • src/main/java/com/example/moviezone/service/Impl/CustomerServiceImpl.java

    r0ba5d1a r00fa72f  
    77
    88import java.util.List;
     9import java.util.Optional;
    910
    1011@Service
     
    2021        return customerRepository.findAll();
    2122    }
     23
     24    @Override
     25    public Optional<Customer> getCustomerById(int id) {
     26        return customerRepository.findById(id);
     27    }
    2228}
  • src/main/java/com/example/moviezone/service/Impl/Projection_RoomServiceImpl.java

    r0ba5d1a r00fa72f  
    2020        return projectionRoomRepository.findAll();
    2121    }
     22
     23    @Override
     24    public List<Projection_Room> getRoomByProjection(int id) {
     25        return projectionRoomRepository.getRoomsForProjection(id);
     26    }
    2227}
  • src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service.Impl;
    22
     3import com.example.moviezone.model.Category;
    34import com.example.moviezone.model.Projection_Room;
    45import com.example.moviezone.model.Seat;
     
    89
    910import java.util.List;
     11import java.util.Optional;
    1012
    1113@Service
    1214public class SeatServiceImpl implements SeatService {
     15
     16
    1317    private final SeatRepository seatRepository;
    1418
     
    2630        return seatRepository.findAllByProjection(projection_room);
    2731    }
     32
     33    @Override
     34    public List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category) {
     35        return seatRepository.findAllByCategoryAndProjection(category,projectionRoom);
     36    }
     37
     38    @Override
     39    public Optional<Seat> getSeatById(int id) {
     40        return Optional.of(seatRepository.getById(id));
     41    }
    2842}
  • src/main/java/com/example/moviezone/service/Impl/TicketServiceImpl.java

    r0ba5d1a r00fa72f  
    11package com.example.moviezone.service.Impl;
    22
    3 import com.example.moviezone.model.Customer;
    4 import com.example.moviezone.model.Ticket;
     3import com.example.moviezone.model.*;
    54import com.example.moviezone.repository.TicketRepository;
    65import com.example.moviezone.service.TicketService;
    76import org.springframework.stereotype.Service;
    87
     8import java.time.LocalDate;
    99import java.util.List;
    1010
     
    2828
    2929    @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
    3042    public Ticket save(long price, Customer customer) {
    3143        return ticketRepository.save(new Ticket(price,customer));
    3244    }
     45
     46    @Override
     47    public Integer priceForTicket(int id) {
     48        return ticketRepository.getPriceForTicket(id);
     49    }
    3350}
Note: See TracChangeset for help on using the changeset viewer.