title: How to access the database from the api controller?
body: <p>I am doing a mobile app with Angular and MVC. I am doing my app calling some dummy data from the json model in the web api. Check my code below:</p>
  
  <pre><code> private IEnumerable&lt;JsonModel&gt; events = new JsonModel[]
      {
         new JsonModel {Id = 1, Title = "title1"}
         new JsonModel {Id = 2, Title = "title2"}
        };
  
  
          // GET api/&lt;controller&gt;
          public IEnumerable&lt;JsonModel&gt; Get()
          {
              return events;
          }
  
          // GET api/&lt;controller&gt;/5
          public JsonModel Get(int id)
          {
              return events.FirstOrDefault(e =&gt; e.Id == id );
          }
  </code></pre>
  
  <p>What I want to do now is to connect my project to the real database. How can I do that? </p>