title: How to pass values with distinct foreign key to the view in asp.net mvc 3
body: <p>I have a 1:m relationship in my code first classes. The orders instance of my view show values with unique OrderID. Since one Customer can have many orders, the foreign key CustID is not unique in this view. </p>
  
  <pre><code>public class Customers
  {
  
      public int CustomerID { get; set; }
  
  
      [StringLength(50, ErrorMessage = "{0} cannot exceed {1} characters")]
      public string LastName { get; set; }
      public string Initials { get; set; }
  
      public string email {get; set;}
     public List&lt;Orders&gt; orders { get; set; }
  }
  </code></pre>
  
  <p>Orders class:</p>
  
  <pre><code>public class Orders
  {
  
          [Key]
          public int OrdersID { get; set; }
          public int OrderName { get; set; }
          public int? CustomerID { get; set; }
          public virtual Customers customer { get; set; }
  
  }
  </code></pre>
  
  <p>Below is my controller:</p>
  
  <pre><code> private custContext db = new custContext();
  
      //
      // GET: /cust/
  
      public ViewResult Index()
      {
          var cust = db.orders.Include(c =&gt; c.customer).Take(10);
          return View(cust.ToList());
      }
  </code></pre>
  
  <p>How do I show only <strong>distinct Customers</strong> in my view with their <strong>OrderNames</strong> in the same view? </p>