title: How to refer the foriegnkey which is an identity column in ASP.Net WebAPI models
body: <p>This is how my ASP.Net REST Web API models looks like and their DataTransferObject models are just a replica of these models without any attributes. I didn't mention ModelDto classes since they look very similar to Models. And I want to populate the database with Entity Framework  Code First approach in c#.</p>
  
  <pre><code>        class Customer
          {
              public int id { get; set; } // this an identity column in db
  
              public string name { get; set; }
  
              public string UserId { get; set; }
  
              public string Source { get; set; }
  
              public DateTime RegisteredOn { get; set; }
          }
  
          // Note: Other than identity column , The combinmation of UserId and Source is unique.
  
          class Ticket
          {
              public int id { get; set; }   // this an identity column in db and its ticketid which is unique
  
              [ForeignKey("Customer")]
              public int id { get; set; } // i am thinking this should refer the identity column of the Customer class since its unique. but if i refer the foreign key as "id" , then i will have two properties in this class one for its own identity column and other one referring to the Customer class.
  
              public string Description { get; set; } // ticket problem description
  
              public DateTime CreatedOn { get; set; }
          }
  
  
          class TicketComment
          {
               public int id { get; set; }   // this an identity column in db and its commentid which is unique
  
               [ForeignKey("Ticket")]
               public int id { get; set; } // i am thinking this should refer the identity column of the Ticket class since its unique. but if i refer the foreign key as "id" , then i will have two properties in this class one for its own identity column and other one referring to the tTicket class.
  
  
               public string Comment { get; set; } // user may add a comment or notes to existing ticket to provide more info or asking for status     
  
          }
  
          class TicketUpdates
          {
              public int id { get; set; }   // this an identity column in db and its updateid which is unique
  
              [ForeignKey("Ticket")]
              public int id { get; set; } // i am thinking this should refer the identity column of the Ticket class since its unique. but if i refer the foreign key as "id" , then i will have two properties in this class one for its own identity column and other one referring to the tTicket class.
  
  
              public string Status { get; set; } // agent may add a status to existing ticket along with some notes
  
          }
  </code></pre>
  
  <p>i have three questions here:</p>
  
  <p>How do i refer to the identity column of the other table/entity when the current table or entity already has an identity column with the same name.( Since i am using Entity framework it always create a table with the identity column name as "id".)</p>
  
  <p>And how do we retrieve the Customer records along with   each customer's tickets, each ticket's comments and each ticket's updates in one get call in REST Web API ? How should my GET method look like in <strong>CustomerController</strong> ?</p>
  
  <p>Should I look at other fields than identity column field to refer the foreign keys ?</p>
  
  <p>I looked at some of the existing posts but my scenario looks a bit different. </p>