title: Send IEnumerable from web api controller to angular js
body: <p>I'm trying to send a IEnumerable from a web api controller to a AngularJs controller.
  The code I was using was</p>
  
  <p>Web Api:</p>
  
  <pre><code>readonly InventoryEntities _db = new InventoryEntities();
  
  public IEnumerable&lt;FDVOEligibilityRequest&gt; Get()
  {
     return _db.FDVOEligibilityRequests.AsEnumerable();
  }
  </code></pre>
  
  <p>AngularJS:</p>
  
  <pre><code>//get all customer information
  $http.get("/api/Customer/").success(function (data) {
          $scope.requests = data;
          $scope.loading = false;
      })
      .error(function () {
          $scope.error = "An Error has occured while loading posts!";
          $scope.loading = false;
      });
  </code></pre>
  
  <p>This worked fine, but now I'm using linq to include related tables and it doesn't work. The angularJs code is the same.
  What am I doing wrong?</p>
  
  <pre><code>readonly InventoryEntities _db = new InventoryEntities();
  
  public IEnumerable&lt;FDVOEligibilityRequest&gt; Get()
  {
      return _db.FDVOEligibilityRequests
          .Include("FDVOEligibilityRequestMandatoryField")
          .Include("FDVOEligibilityRequestDCCField").AsEnumerable();
  }
  </code></pre>
  
  <p>I do get the data I want in the controller, but when i try to send it back to angular, I get a 500 (Internal Server Error) angular.js:10722</p>
  
  <p>This is what FDVOEligibilityRequest looks like in the new Web Api controller</p>
  
  <pre><code>public partial class FDVOEligibilityRequest
  {
      public int Id { get; set; }
      public string TestName { get; set; }
      public string GroupName { get; set; }
      public int MandatoryFieldsID { get; set; }
      public int DCCFieldsID { get; set; }
      public virtual FDVOEligibilityRequestMandatoryField FDVOEligibilityRequestMandatoryField { get; set; }
      public virtual FDVOEligibilityRequestDCCField FDVOEligibilityRequestDCCField { get; set; }
  }
  </code></pre>