I have the following tables in my database:
- Reservation
- TrainStation
- Train
- Traveller
- Reservation_Traveller
- TrainSeats: Attributes are: Train_Id, Seat, Traveller_Id
I want to find the TrainSeats rows of a particular Reservation
I have a Reservation object that contains an ICollection<Traveller> property containing the travellers of which I want to remove their seats from the TrainSeats table. I fetched the reservation object from the database like this:
var reservation = db.Reservation.Where(r => r.Id == id).FirstOrDefault();
So I want to do something like this:
db.TrainSeats.Where(ts => ts.Traveller_Id IN reservation.Travellers)