Linq对sql和c#, WPF的选择问题

本文关键字:WPF 选择 问题 sql Linq | 更新日期: 2023-09-27 18:03:20

我有两个房间,bookerooms

想要select BookedRooms.RoomID(which is more than one) than select Rooms.SizeX and Room.SizeX from Rooms where Room.ID == BoookedRooms.RoomID

Than Filter Room。ID列表,只留下ID which != BookedRooms.ID请帮助

Linq对sql和c#, WPF的选择问题

我猜?

from bookedRooms in db.BookedRooms
from rooms in db.Rooms
where bookedRooms.RoomId == rooms.ID && rooms.ID != bookedRooms.ID
select new { SizeX = rooms.SizeX, SizeY = rooms.SizeY }

您想要一份未预订的房间列表,对吗?

var availableRooms = Rooms.Where(r => !BookedRooms.Any(b => b.RoomID == r.ID);