My requirement is that user can book seats for a particular theatre for a particular movie at a specific show time.
How can I maintain availability status of a seat for that show time.
If the check the master seat table for the total seats, in which data layer I can set a boolean say, "isAvaialble" for that show against a particular seatID.
How would be the data join?
Could you please provide an idea to achieve this requirement?
Dusan Rodina - softwareideas.net
13 May 2021 17:21:47
RE: How to persist seat availability data
Hi,
You are welcome.
The described requirement can be achieved with the given model. If you find a reservation for the seat and the scheduled movie (that defines the movie and its show time), the seat is not available.
You can also modify the model so that the Reservation entity will include the IsAvailable flag and after scheduling a movie, the reservations (records) will be initialized for all seats with IsAvailable set to True.
In the original model, if this query returns a row the seat is taken. Otherwise, for an empty result, the seat is free.
SELECT * FROM Reservation
INNER JOIN Seat ON Seat.ID = Reservation.SeatID
WHERE
Seat.Number = <ChosenSeat>
AND Reservation.MovieID = <ChosenMovieAtShowTime>
You can also join the ScheduledMovie entity if you want to select the movie by its time. If you want to select the data also by movie name, you can also join the Movie entity.
Abhimun 13 May 2021 12:35:33
How to persist seat availability data
Dusan Rodina - softwareideas.net 13 May 2021 17:21:47
RE: How to persist seat availability data