'ASP.NET Core Razor Read related data into table

I am trying to create a asp.net core 2.1 razor website that will load two tables on the one page. Below i have defined my classes ItemMasters and DealMasters. ItemMasters stores items of clothing and DealMasters stores deals on them items. DealMasters stores the relevant ItemID with DealItemId

im trying to have the getItem Page to show the deals table but only the entires where the DealItemId matches the ID of the item on the page



Solution 1:[1]

im trying to have the getItem Page to show the deals table but only the entires where the DealItemId matches the ID of the item on the page

It is because the you use FirstOrDefaultAsync(m => m.DealItemID == this.id),try to use:

DealsMasters = await _context.DealsMasters.ToListAsync();

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1