Index: src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java
===================================================================
--- src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java	(revision 72157734e5caa6004a56b3f1b39cf89132224c8a)
+++ src/main/java/com/example/moviezone/service/Impl/SeatServiceImpl.java	(revision 8a18cf58c2ae7a2c1544e33afa80cfb7b8b84515)
@@ -4,8 +4,13 @@
 import com.example.moviezone.model.Projection_Room;
 import com.example.moviezone.model.Seat;
+import com.example.moviezone.model.Ticket;
+import com.example.moviezone.model.manytomany.ProjectionIsPlayedInRoom;
+import com.example.moviezone.repository.ProjectionIsPlayedInRoomRepository;
+import com.example.moviezone.repository.Projection_RoomRepository;
 import com.example.moviezone.repository.SeatRepository;
 import com.example.moviezone.service.SeatService;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Optional;
@@ -16,7 +21,13 @@
 
     private final SeatRepository seatRepository;
+    private final TicketServiceImpl ticketService;
+    private final ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository;
+    private final Projection_RoomRepository projection_roomRepository;
 
-    public SeatServiceImpl(SeatRepository seatRepository) {
+    public SeatServiceImpl(SeatRepository seatRepository, TicketServiceImpl ticketService, ProjectionIsPlayedInRoomRepository projectionIsPlayedInRoomRepository, Projection_RoomRepository projection_roomRepository) {
         this.seatRepository = seatRepository;
+        this.ticketService = ticketService;
+        this.projectionIsPlayedInRoomRepository = projectionIsPlayedInRoomRepository;
+        this.projection_roomRepository = projection_roomRepository;
     }
 
@@ -33,5 +44,32 @@
     @Override
     public List<Seat> findAllByRoomAndCategory(Projection_Room projectionRoom, Category category) {
-        return seatRepository.findAllByCategoryAndProjection(category,projectionRoom);
+        List<Ticket> tickets=ticketService.findAllTickets();
+        List<Seat> seats=seatRepository.findAllByCategoryAndProjection(category,projectionRoom);
+        List<Seat> s=new ArrayList<>();
+        List<Projection_Room> projection_rooms=new ArrayList<>();
+        for (int i = 0; i < tickets.size(); i++) {
+            List<ProjectionIsPlayedInRoom> projectionIsPlayedInRooms= projectionIsPlayedInRoomRepository.findAllByProjectionId(tickets.get(i).getProjection().getId_projection());
+            for (int j = 0; j < projectionIsPlayedInRooms.size(); j++) {
+                projection_rooms.add(projection_roomRepository.getById(projectionIsPlayedInRooms.get(j).getIdroom()));
+            }
+        }
+        int f=0;
+        for (int i = 0; i < seats.size(); i++) {
+            for (int j = 0; j < tickets.size(); j++) {
+                if(seats.get(i).getId_seat().equals(tickets.get(j).getSeat().getId_seat())){
+                    for (int k = 0; k < projection_rooms.size(); k++) {
+                        if(seats.get(i).getProjection().getId_room().equals(projection_rooms.get(k).getId_room()))
+                            f=1;
+                    }
+                }
+
+            }
+
+            if(f==0){
+                s.add(seats.get(i));
+            }
+            f=0;
+        }
+        return s;
     }
 
Index: src/main/java/com/example/moviezone/web/HomeController.java
===================================================================
--- src/main/java/com/example/moviezone/web/HomeController.java	(revision 72157734e5caa6004a56b3f1b39cf89132224c8a)
+++ src/main/java/com/example/moviezone/web/HomeController.java	(revision 8a18cf58c2ae7a2c1544e33afa80cfb7b8b84515)
@@ -199,5 +199,5 @@
             response.sendRedirect("/login");
         }
-        
+
     }
     @GetMapping("/registerWorker")
@@ -396,11 +396,17 @@
         Customer customer=customerService.findByUsername(request.getRemoteUser());
         Projection projection1=projectionService.findById(projection.intValue());
-        if(projection1.getDiscount().equals(discount)){
+        if(projection1.getDiscount()!=null && projection1.getDiscount().getCode().equals(discount)){
             t=ticketService.saveWithDiscount(LocalDate.now(),customer,projection1,projection1.getDiscount(),seatService.getSeatById(id_seat.intValue()).get());
+            Integer price=ticketService.priceForTicket(t.getId_ticket());
+            price+=seatService.getSeatById(id_seat.intValue()).get().getCategory().getExtra_amount();
+            price-=(price*projection1.getDiscount().getPercent())/100;
+            t.setPrice(price);
         }else{
             t=ticketService.saveWithout(LocalDate.now(),customer,projection1,seatService.getSeatById(id_seat.intValue()).get());
-        }
-        Integer price=ticketService.priceForTicket(t.getId_ticket());
-        t.setPrice(price);
+            Integer price=ticketService.priceForTicket(t.getId_ticket());
+            price+=seatService.getSeatById(id_seat.intValue()).get().getCategory().getExtra_amount();
+            t.setPrice(price);
+        }
+
         return "redirect:/myTickets";
     }
