title: LINQ queries possible to use Foreign key to get value from other table
body: <p>Is it possible to make a LINQ method query to the table Timeunit below and use the foreign key Employee or Order to get data from certain rows?</p>
  
  <p>This is what I'm trying to achieve. To the View I pass a ViewModel with Timeunit, Employee and Order. And within a ForEach loop of Order in the View, I try to get all employees who have been working with that order. Is this possible or am I thinking wrong here?</p>
  
  <pre><code>@foreach (var item1 in Model.orderlist)
  {
  @Model.timeunitlist.Where(x =&gt; x.OrderID == item1.EmployeeID).FirstName ????
  }
  
  public class Timeunit
  {
  public int ID { get; set; }
  public int Week { get; set; }
  public int HoursPerWeek { get; set; }
  public int EmployeeID { get; set; }
  public int? OrderID { get; set; } 
  public virtual Employee Employee { get; set; }
  public virtual Order Order { get; set; }
  }
  </code></pre>
  
  <p>EDIT 1: The other two tables</p>
  
  <pre><code>public class Order
  {
  public int ID { get; set; }
  public string Name { get; set; }
  public int? ManufacturerID { get; set; }
  public virtual Manufacturer Manufacturer { get; set; }
  public virtual ICollection&lt;Employee&gt; Employees { get; set; }
  }
  
  public class Employee
  {
  public int ID { get; set; }
  public string Name { get; set; }
  public int EmployeeNumber { get; set; }
  public virtual ICollection&lt;Timeunit&gt; Timeunits { get; set; }
  public virtual ICollection&lt;Order&gt; Orders { get; set; }
  }
  </code></pre>
  
  <p>EDIT 2: The View Model</p>
  
  <pre><code>public class ViewModel
  {
      public List&lt;Timeunit&gt; timeunitList = new List&lt;Timeunit&gt;();
      public List&lt;Employee&gt; employeeList = new List&lt;Employee&gt;();
      public List&lt;Order&gt; orderList = new List&lt;Order&gt;();
  }
  </code></pre>
  
  <p>What I need is for each Order, I need to list all Timeunits that match each Order a certain week and to show how many hours each Employee has worked in each Order</p>