0
我有以下的LINQ到實體查詢:基於另一個LINQ到實體的結果更新一個實體查詢
' Get all the residency assignments that match the term/year.
Dim assignments = From p In dbContext.Residents _
Where p.semester = term _
Where p.year = year _
Select p
這會給我所有本年度/學期駐地分配。然後我有這個LINQ-to-Entities查詢:
Dim reset_occupancy = From p In dbContext.Rooms _
Select p
這會給我所有的房間。我想遍歷任務,並根據分配的房間更新reset_occupancy中的佔用情況。我不是100%確定如何做到這一點。這裏是什麼,我要完成我的僞代碼:
For each row in assignments
reset_occupancy.Where(reset_occupancy.room=assignment.occupancy).current_occupancy =+1
Next