Friday, April 13, 2018

How can I the best find rooms which are not occupied (next question on this https://ift.tt/2GYElXh

Hello,

On this subject ( https://www.reddit.com/r/dotnet/comments/8by6ko/can_this_be_done_with_linq_only_this_sql_looks_in/) I asked if I can do something with Linq,

Now I wonder if there is a "better" way to do things.

What I have is right now 2 tables.

Rooms : RoomId RoomNumber AdultsCapacity ChildrenCapacity

Booking : BookingId GuestLastName GuestFirstName RoomId NumberOfAdults NumberOfChildren CheckInDate CheckOutDate

Now I have to find a room for someone who wants to book a room in a hotel.

Which has this requirements.

  • Number of Adults must be smaller or equal to AdultsCapacity
  • Number of Children must be smaller or equal to Childrenscapacity
  • Room must not be occupied.
    • CheckIndate must be in the range of CheckIndate and CheckOutdate of a booking that has already booked.
    • Status of the Room must not be booked or Checkin in that period.

Anyone who knows a way I can find a room that is not occupied in the period that a person wants to book a room.

Any chances to the tables is allright with me,

Roelof

How can I the best find rooms which are not occupied (next question on this https://ift.tt/2GYElXh Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team