I want to compare the values inside the ids array with the ItemID value in the ItemsOfCars table. ItemsOfCars is a table relationship to many to many.
As an example, I have values 1,2,3,4,5 in ItemsOfCars. I have values 1, 2 in the array named ids. I want to compare them and get the values 3, 4, 5 that are in the ItemsOfCars array but not in the ids array.
[HttpPost]
public IActionResult GetItems(int[] ids)
{
foreach (var item in items)
{
item.ItemsOfCars.Where(x => x.ItemId == ids)
}
}
try this:
public IActionResult GetItems(int[] ids)
{
var items= ItemsOfCars.Where(i => !ids.Contains(i.ItemId));
}
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加