title: Use Linq to get Top 10 Customers
body: <p>I have the following two POCO's</p>
  
  <pre><code>public class Customers
  {
      public Guid Id { get; set; }
      public string FirstName{ get; set; }
      public string LastName{ get; set; }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class Orders
  {
      public Guid Id { get; set; }
      public Guid CustomerId { get; set; }
      public string Product { get; set; }
      public DateTime Date { get; set; }
  }
  </code></pre>
  
  <p>Assuming my Data Service returns a List&lt;Customers&gt; and List&lt;Orders&gt;, how would I use Linq to Get the Top 10 Most Active Customers (most orders)?</p>
  
  <p>I want to return Customer.Id, Customer.FirstName, Customer.LastName, Count, (as Json from a controller action), so I created a new POCO to hold results. something like the following:</p>
  
  <pre><code>public class MostActive
  {
      public Guid Id { get; set; }
      public string FirstName { get; set; }
      public string LastName { get; set; }
      public int Count { get; set; }
  }
  </code></pre>
  
  <p>Although it's not working, here is what my current attempt looks like so far:</p>
  
  <pre><code>var results = (from c in Customers
                from o in Orders
                where c.Id == o.CustomerId
                orderby c.Id.Count descending
                select new MostActive
                    {
                        FirstName = c.FirstName,
                        LastName = c.LastName,
                        Id = c.Id,
                        Count = h.Id.Count
                    }).Take(10);
  </code></pre>