title: Linq group by and order by sum
body: <p>I simply want to do this SQL in Linq. But how?</p>
  
  <pre><code>Select Id, sum(Count) 
  from dbo.BThread 
  group by Id 
  order by sum(Count) desc
  </code></pre>
  
  <p>I tried this and its fails: the result gives only one row. I expect a lot more rows than this. There is many ids that I need to sum count on.</p>
  
  <pre><code>var List = (from tbBThread in context.BThread.Take(10)
                  group tbBThread by tbBThread.Id into bTmp
                  orderby bTmp.Sum(x =&gt; x.Count)
                  select new BViewModel
                  {
                      Id = bTmp.Key,
                      Id = bTmp.First().Id,
                      Count = bTmp.Sum(x =&gt; x.Count)
                  }).ToList();
  </code></pre>