I am developing a MVC application and I want a list of items order by descending by using the sum of its field's valued. I got the sum but its not getting ordered by descending based on that sum.
var SharedStories = (from p in PublishedLivestories select p).ToList();
SharedStories = (from p in SharedStories
let totlaSharedCountOfStory = SharedStories.Sum(s => s.SharedOnFacebookCount
orderby totlaSharedCountOfStory descending
var result= SharedStories.OrderByDescending(x => x.SharedOnFacebookCount + x.SharedOnGoogleCount + x.SharedOnTwitterCount + x.SharedOnInstagramCount + x.SharedOnLinkedInCount + x.SharedOnPinterestCount) .ToList();