title: Grouping in Entity Framework MVC
body: <p>Hi all i've currently got a list of telephone numbers being output using:-</p>
  
  <p>Controller:-</p>
  
  <pre><code>public ActionResult ViewSubRange(int id)
  {
      IEnumerable&lt;Number&gt; numbers = context.Numbers.Where(m =&gt; m.RangeID == id).ToList();
  
      return View("SubRange", numbers);
  }
  </code></pre>
  
  <p>View:-</p>
  
  <pre><code>@model IEnumerable&lt;TelephoneNumberManagement.Models.Number&gt;
  &lt;table&gt;
      &lt;tr&gt;
          &lt;th&gt;
              Number
          &lt;/th&gt;
          &lt;th&gt;
              Status
          &lt;/th&gt;
      &lt;/tr&gt;
  
  @foreach (var item in Model)
  {
      &lt;tr&gt; 
          &lt;td&gt;@item.Number1&lt;/td&gt;
          &lt;td&gt;@item.Status.StatusName&lt;/td&gt;
      &lt;/tr&gt; 
  
  }
  
  &lt;/table&gt;
  </code></pre>
  
  <p>This is fine, however i've noticed that we can have a lot of numbers being output. I was wondering if its possible to group the numbers, so for example by Customer. So what i want to achieve is something like:-</p>
  
  <blockquote>
    <p>01132210000-01132210999 CUSTOMER A</p>
    
    <p>01132211000-01132211009 CUSTOMER B</p>
    
    <p>01132211010-01132211029 CUSTOMER C</p>
  </blockquote>