Skip to content

Instantly share code, notes, and snippets.

@kgamecarter
Last active July 13, 2021 04:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kgamecarter/271414f75784ef117f7035784ff9625a to your computer and use it in GitHub Desktop.
Save kgamecarter/271414f75784ef117f7035784ff9625a to your computer and use it in GitHub Desktop.
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