Ordering sub-items within ordered items in a Linq to Entities Query

后端 未结 1 1386
鱼传尺愫
鱼传尺愫 2021-01-24 09:44

I have a few tables, Listings, ListingImages and a few others related to Listings. ListingImages is related to Listings so that you can have many ListingImages per Listing.

相关标签:
1条回答
  • 2021-01-24 10:02

    I think you are going to have to sort it in the view, because if you want each group to have a different sorting, you have to do that manually. The only other option is to copy it to a dictionary or list structure and sort and copy it in the order, then return that from the controller... though I don't even know where to begin on that one.

    I don't think sorting on the view is bad form, because it's part of the UI logic (or the UI's needs anyway)... it would be bad form to query data within the view, and be careful not to put too much logic in (I don't know the complexity you are talking about), but as long as its only sorting, I think that's OK.

    HTH.

    0 讨论(0)
提交回复
热议问题