❔ Help with EF Core Linq statement
the method at line 138: https://github.com/dzenis-zigo/Frizerski-Salon-ML/blob/main/SalonML/SalonML_API/Controllers/DynamicContentController.cs
How can I implement sorting by
OrderIndex
?GitHub
Frizerski-Salon-ML/DynamicContentController.cs at main · dzenis-zig...
Contribute to dzenis-zigo/Frizerski-Salon-ML development by creating an account on GitHub.
11 Replies
Like this:
.OrderByDescending(x => x.OrderIndex)
Seems you already have itok so my table is
Unique Id
| Not Unique Name
| OrderIndex
I want to return data so that all the non-unique Name
rows are next to eachotherWhat do you mean "next to eachother"?
well ToLookup puts identical
Name
s in their own arrayAh, so it groups the entries by the names?
Never in my life have I used
.ToLookup()
.GroupBy()
if anything
So, that explains why nothing gets sorted
You sort the entries first, then you group themoh interesting
Do you want entries within each group to be sorted? Or do you want groups themselves to be sorted somehow?
Huh, right, grouping might not translate well
I guess if you're fetching everything regardless, might as well do the grouping on the client
i see
sorting first then grouping makes sense
thank you @Angius i learned something
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.