result set using two different views (from an if statement)
- by mailman1979
Hi All,
I have a bit of code that works with a result set called "result" (original I know) but depending on the incoming variable I'd like to fire the specific query depending. I have the below in an if statement but that just makes the "result" recordset gets those nasty red lines and it doesn't work. I'm sure this is easy to work out.
if (area == "dashboard")
{
IQueryable<ViewGetNavigationMainItem> result = (from m in _entities.ViewGetNavigationMainItems
where m.area.Trim() == area.Trim()
where m.state == "Online"
where m.parentID == parentID
orderby m.sequence ascending
select m);
}
else
{
//Get the Content Items
IQueryable<ViewGetNavigationContentItem> result = (from m in _entities.ViewGetNavigationContentItems
where m.navID == navID
where m.parentID == parentID
orderby m.contentOrder ascending
select m);
}
maxRecords = result.Count();
foreach (var item in result)
{ etc etc etc