How to join two tables with Linq in an MVC controller
<p>I have two sql database tables with a 1:n relationship. For my ASP.NET MVC-solution I have enabled EF-code-first-migration and the proper DBContext and classes established.</p>

<p>I would like to write an MVC-controller that joins both tables in order to select specific records for display in a view. </p>

<p>Here are the two classes:</p>

<pre><code>        public class Tbl_Group_Communities : Entity
{
    public string GKZ { get; set; }
    public int G_ID { get; set; }
}

    public class Katastralgemeinden : Entity
{
    public string KGNr { get; set; }
    public string KGName { get; set; }
    public string GKZ { get; set; }
    public string GemeindeName { get; set; }
}
</code></pre>

<p>So far I have been able to come up with a working controller for the tables  by themselves but not joined. Below the working controller for the first class:</p>

<pre><code>            public IEnumerable&lt;Tbl_Group_Communities&gt; Get()
    {
        var entities = UnitOfWork.GetAll&lt;Tbl_Group_Communities&gt;().ToList();
        return entities;
    }
</code></pre>

<p>I think, the join can be done with Linq but I have no idea how/where to start. 
The common key for both tables is GKZ; so the join should be established via GKZ. And then I need to select specific records from the joined records where G_ID = a certain value.</p>

<p>If someone could give me some help, I'd be very thankful.
Manu</p>