I am trying to do some sorting based on the count() within a bundle, but I am not having much luck.
I have this sorting that works fine by sorting all the null values last
customerBasket.ItemsInBasket = customerBasket.ItemsInBasket.Where(s => s.BundleId != null)
.OrderBy(s => s.BundleId)
.ThenBy(s => s.ThisItemsCountWithinBundle)
.Concat(customerBasket.ItemsInBasket.Where(s => s.BundleId == null))
.ToList();
But then when I want to use concat again to sort "non full" bundles and put them last this cannot be done, I am trying this
customerBasket.ItemsInBasket = customerBasket.ItemsInBasket.GroupBy(s => s.BundleId)
.Where(s => s.Count() == 3)
.Concat(customerBasket.ItemsInBasket.GroupBy(s => s.BundleId)
.Where(s => s.Count() < 3)
.SelectMany(s => s.ToList()));
But this gives me the following error message
Severity Code Description Project File Line Suppression State Error CS1929 'IEnumerable<IGrouping<string, ItemInBasket>>' does not contain a definition for 'Concat' and the best extension method overload 'Queryable.Concat(IQueryable, IEnumerable)' requires a receiver of type 'IQueryable' slapi C:\Users\Matt\source\repos\SLAPI\Utils\BasketHelpers.cs 20 Active
Not sure how I can fix this problem.