title: Get details from 2 tables asp.net web api
body: <p>I'm creating a web api. I have two tables</p>
  
  <p><code>Employee_details</code></p>
  
  <pre><code>SlNo      Employeeid        R_ID
   1         2022             AC1
   2         2023             AC2
  </code></pre>
  
  <p><code>Id_details</code></p>
  
  <pre><code>SlNo        R_ID            L_ID
   1          AC1             L001
   2          AC1             L002
   3          AC1             L003
   4          AC2             L004
   5          AC2             L005
  </code></pre>
  
  <p>I created a web api with RESTful services. I need to get all the L_ID of a particular Employeeid. For example if I request for employeeid 2022 I should get L001 L002 and L003. Help me please. I created the tables using code first and enabling migration</p>
  
  <p>Code</p>
  
  <p>Model class</p>
  
  <p>Employee_details.cs</p>
  
  <pre><code>public class Employee_details
  {
     public int slNo {get; set;}
     public string Employeeid  {get; set;}
     public string R_ID  {get; set;}
  
     //Navigation
     public Id_details Id_details{get; set;}
  }
  </code></pre>
  
  <p>Id_details.cs</p>
  
  <pre><code>public class Id_details
  {
     public int slNo {get; set;}
     public string R_ID  {get; set;}
     public string  L_ID {get; set;}
  
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code> public IQueryable&lt;Employee_id&gt; Getdetails(string employeeid )
      {
         return db.Employee_details
             .Where(b =&gt; b.Employeeid.Equals(employeeid, StringComparison.OrdinalIgnoreCase)).Include(c =&gt; c.Id_details);
  
      }
  </code></pre>
  
  <p>I did not make foreign key reference since R_ID field in Table 2 is not a primary key.</p>