var sales = _salesService.GetSales(parameters)
The list is something like
var listSales = new List<SalesData>();
listSales .Add(new SalesData
{
Name = "Apple",
Quantity = 1000
});
listSales .Add(new SalesData
{
Name = "Banana",
Quantity = 2000
});
listSales .Add(new SalesData
{
Name = "Peach",
Quantity = 1
});
listSales .Add(new SalesData
{
Name = "Mango",
Quantity = 1
});
I want to write a linq query so that I can group the 'Name' as 'Others' if the quantity is less than 1 percent of the total quantity.
So result of the query should be something like
Apple 56
Banana 23
Others 2 -- ( peach's quantity less than than 1% + Mango Quantity less than 1%)