I am trying to filter based on a table hierarchical relationship. But getting the error below.
I am trying to filter based on the variable C in c.Departments_Category_Registration.Category_Name == C
Can anyone advise, here is my code
var model = from r in _context.Departments_SubCategory_Registration.Include(c => c.Departments_Category_Registration.Category_Name == C)
where r.IsEnabled == true
select r;
return View(model);
and error messageInvalidOperationException: Incorrect include argument: c => (c.Departments_Category_Registration.Category_Name == __C_0)
update. I changed my code to this below and get no error, but yields no results
[Route("/{C}")]
public async Task<IActionResult> Product(String C)
{
return View(await _context.Departments_SubCategory_Registration.Include(c => c.Departments_Category_Registration)
.Where (d => d.IsEnabled == true)
.Where(r => r.Departments_Category_Registration.Category_Name == C).ToListAsync());