title: Calling Web API from MVC controller
body: <p>I have a WebAPI Controller within my MVC5 project solution.
  The WebAPI has a method which returns all files in a specific folder as a Json list: </p>
  
  <p><code>[{"name":"file1.zip", "path":"c:\\"}, {...}]</code></p>
  
  <p>From my HomeController I want to call this Method, convert the Json response to <code>List&lt;QDocument&gt;</code> and return this list to a Razor view. This list might be empty: <code>[]</code> if there are no files in the folder.</p>
  
  <p>This is the APIController:</p>
  
  <pre><code>public class DocumentsController : ApiController
  {
      #region Methods
      /// &lt;summary&gt;
      /// Get all files in the repository as Json.
      /// &lt;/summary&gt;
      /// &lt;returns&gt;Json representation of QDocumentRecord.&lt;/returns&gt;
      public HttpResponseMessage GetAllRecords()
      {
        // All code to find the files are here and is working perfectly...
  
           return new HttpResponseMessage()
           {
               Content = new StringContent(JsonConvert.SerializeObject(listOfFiles), Encoding.UTF8, "application/json")
           };
      }               
  }
  </code></pre>
  
  <p>Here is my HomeController:</p>
  
  <pre><code>public class HomeController : Controller
  {
       public Index()
       {
        // I want to call APi GetAllFiles and put the result to variable:
        var files = JsonConvert.DeserializeObject&lt;List&lt;QDocumentRecord&gt;&gt;(API return Json);
        }
   }
  </code></pre>
  
  <p>Finally this is the model in case you need it:</p>
  
  <pre><code>public class QDocumentRecord
  {
        public string id {get; set;}
        public string path {get; set;}
     .....
  }
  </code></pre>
  
  <p>So how can I make this call?</p>