Friday, April 13, 2018

Can this be done with Linq only ? This sql looks in the database for a empty room where the number of clients fit in

Hello,

Someone give me this sql :

SELECT {Room}.* FROM {Room} WHERE @NumberOfAdults > 0 AND {Room}.[AdultsCapacity] >= @NumberOfAdults AND {Room}.[AdultsCapacity]+{Room}.[ChildrenCapacity]>=@NumberOfAdults+@NumberOfChildren AND NOT EXISTS (SELECT 1 FROM {Booking} WHERE {Booking}.[RoomId] = {Room}.[Id] AND (@CheckInDate BETWEEN {Booking}.[CheckInDate] AND {Booking}.[CheckOutDate] - 1 OR @CheckOutDate BETWEEN {Booking}.[CheckInDate] + 1 AND {Booking}.[CheckOutDate]) AND {Booking}.[StatusId] <> @Canceled) ORDER BY {Room}.[Price] ASC

Can this also be done in linq. and if so, how does it looks like ?

Can this be done with Linq only ? This sql looks in the database for a empty room where the number of clients fit in Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team