title: Empty JSON Response from Controller in C# Web API
body: <p>I am learning about building web APIs in C#.</p>
  
  <p>I am testing my controller, however I am getting an empty <code>JSON</code> response.</p>
  
  <p>This is my controller</p>
  
  <pre><code>public class ClassInfoController : ApiController
  {
      private ClassRepository classRepo = new ClassRepository();
  
      public IList&lt;string&gt; getClassListByTerm(string termID)
      {
          List&lt;string&gt; classList = classRepo.getClassListByTerm(termID);
  
          return classList;
      }
  </code></pre>
  
  <p>This is my repository class which queries my Entity model</p>
  
  <pre><code>public class ClassRepository : IClass
  {
  
      private cet_databaseEntities db = new cet_databaseEntities();
  
      public List&lt;string&gt; getClassListByTerm(string termID)
      {
          List&lt;string&gt; result = (from t in db.classCodeLookup
                  where t.termID == termID
                  orderby t.@class ascending
                  select t.@class).ToList&lt;string&gt;();
  
          return result;
      }
  }
  </code></pre>
  
  <p>I have debugged my controller and when the API call is made, this repository class returns no data to the controller i.e. an empty <code>list</code>. However, the reason I am confused, is that when I use the following test code on the repository class</p>
  
  <pre><code>public class ClassRepositoryTests
  {
      ClassRepository testRepo = new ClassRepository();
  
      [TestMethod()]
      public void getClassListByTermTest()
      {
          List&lt;string&gt; output = testRepo.getClassListByTerm("316a");
          foreach (string className in output)
          {
              Console.WriteLine(className);
          }
      }
  }
  </code></pre>
  
  <p>I get the result from the repository class I expect.</p>
  
  <p>Why am I having this issue?</p>