I have the following code:
if (pick == null || pick == "active")
{
var Proj = db.usp_Train(idnbr)
.Where(a => a.Inactive == false).ToList();
}
else
{
var Proj = db.usp_Train(idnbr).ToList();
}
return PartialView(Proj);
For where I have return PartialView(Projs) I get a message saying that Proj does not exist in the current Any idea on how I can fix this.
You’re declaring
Projwithin the scopes of theifandelseblocks – so it doesn’t exist outside those blocks. You want something like:Alternatively, you could use the conditional operator:
Or selectively apply the condition, which removes all the redundancy: