I currently have a list containing the following
CountryCode (string)
CountryStr (string)
RegionStr (string)
RegionID (int)
AreaStr (string)
AreaID (int)
This is a flattened set of related data (so basically ive search results stored in ive)
The MVC route will only pass one line, which I then need to map to the data at the correct level in heirachy. Therefore, I try to query CountryStr then if it does not produce results in the region, and then in the region; but I need to make this request bit and, for example, ...
var datURL = (from xs in myList
where xs.RegionStr == rarREF
select new
{
regionID = xs.RegionId,
CountryID = xs.CountryCd
}
where xs.AreaStr == rarREF
select new
{
AreaID = xs.AreaID
regionID = xs.RegionId,
CountryID = xs.CountryCd
}
).ToList();
The only way that I see at the moment is to execute each request separately and then check which return values and use this one. I hope there is a smarter, cleaner method.