Skip to content

Instantly share code, notes, and snippets.

@kgamecarter
Last active Jul 13, 2021
Embed
What would you like to do?
var list = result.Date
.GroupBy(x => new { x.City_Id, x.City_Name, x.Region_Id, x.Region_Name })
.GroupBy(g1 => new { g1.Key.City_Id, g1.Key.City_Name })
.Select(g2 => new StoreAddressModel()
{
City_Id = g2.Key.City_Id,
City_Name = g2.Key.City_Name,
Region = g2.Select(g1 => new Region()
{
Region_Id = g1.Key.Region_Id,
Region_Name = g1.Key.Region_Name,
Vendor = g1.Select(x => new Vendor()
{
Vendor_Id = x.Vendor_Id,
Vendor_nme = x.Vendor_nme
}).ToList()
}).ToList()
}).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment