Skip to content

Instantly share code, notes, and snippets.

@SelvinPL
Created December 12, 2019 11:56
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 SelvinPL/896766c603157749cf478ccda07b38db to your computer and use it in GitHub Desktop.
Save SelvinPL/896766c603157749cf478ccda07b38db to your computer and use it in GitHub Desktop.
SO59303710
var result = paymentCollections
.GroupBy(l =>
{
switch(l.PaymentStatus)
{
case "Status1":
return "Unit1";
case "Status2":
case "Status3":
return "Unit2";
case "Status4":
return "Unit3";
case "Status5":
case "Status6":
return "Unit4";
}
return "Unk";
})
.Select(cl => new MoneyMovement
{
CollectionUnit = cl.Key,
MoneyCollected = cl.Sum(c => c.Amount).ToString(),
NoOfReceipt = cl.Count().ToString(),
}).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment