attempting to return a multiple group by object
Was hoping for some help with Nested group by in linq where I am trying to
go down three levels.
Basically the path would go down Business to BusUnit to Level1
So under Business there are various BusUnits and under BusUnits there are
various level1 values
I want to return this as a Json object.
As I have it at the moment I got down to BusUnits
as follow
var queryNestedData = (from r in DataItems
group r by r.Business into businesses
from businessUnits in
(from r in businesses
group r by r.Businessunit)
group businessUnits by businesses.Key).Select(tg =>
new
{
Business = tg.Key,
BusinessUnits = tg.Select(tv => new {
BusinessUnit = tv.Key })
});
How could I get to Level1 so as to return the values as well?
No comments:
Post a Comment