Skip to content

Instantly share code, notes, and snippets.

@beachandbytes
Last active December 24, 2015 23:09
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 beachandbytes/6878518 to your computer and use it in GitHub Desktop.
Save beachandbytes/6878518 to your computer and use it in GitHub Desktop.
var newResult = (from client in ctx.Audit().Where(z => batches.Contains(z.BatchID) || batches.Count == 0)
group client by new
{
client.BatchID,
client.PrevBatchID,
client.BatchNo ,
client.PrevBatchNo ,
} into clientGroup
select new Clients
{
BatchID = clientGroup.Key.BatchID,
PrevBatchID = clientGroup.Key.PrevBatchID,
BatchNo = clientGroup.Key.BatchNo,
PrevBatchNo = clientGroup.Key.PrevBatchNo,
EmployeeList = (from employee in clientGroup
select new Employee
{
Id = employee.ID,
Name = employee.Name,
Amt = employee.Amt
}).ToList()
}).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment