Q:

LINQ queries possible to use Foreign key to get value from other table

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?
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?
@foreach (var item1 in Model.orderlist)
{
@Model.timeunitlist.Where(x => 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; }
}

EDIT 1: The other two tables
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<Employee> Employees { get; set; }
}

public class Employee
{
public int ID { get; set; }
public string Name { get; set; }
public int EmployeeNumber { get; set; }
public virtual ICollection<Timeunit> Timeunits { get; set; }
public virtual ICollection<Order> Orders { get; set; }
}

EDIT 2: The View Model
public class ViewModel
{
    public List<Timeunit> timeunitList = new List<Timeunit>();
    public List<Employee> employeeList = new List<Employee>();
    public List<Order> orderList = new List<Order>();
}

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

A:

To display your collection of Timeunit grouped by Order you need to use a linq .GroupBy() clause.  Start by creating view models to represent what you want to display in the view
public class OrderVM
{
    public string Name { get; set; }
    public IEnumerable<EmployeeVM> Employees { get; set; }
}
public class EmployeeVM
{
    public string Name { get; set; }
    public int Hours { get; set; }
}

and the in the controller, use a linq query to project you data into the view models
IEnumerable<OrderVM> model = db.Timeunits
    .Where(x => x.Week == 1)
    .GroupBy(x => x.OrderID)
    .Select(x => new OrderVM()
    {
        Name = x.FirstOrDefault().Order.Name,
        Employees = x.Select(y => new EmployeeVM()
        {
            Name = y.Employee.Name,
            Hours = y.HoursPerWeek
        })
    }).AsEnumerable();
return View(model);

and then in the view
@model IEnumerable<OrderVM>
@foreach (var order in Model)
{
    @Html.DisplayFor(m => order.Name)
    foreach(var employee in order.Employees)
    {
         @Html.DisplayFor(m => employee.Name)
         @Html.DisplayFor(m => employee.Hours)
    }
}

