title: Web API 2 : Best Practice returning ViewModel data from Controller to $http Success result ?
body: <p>I wonder what's the recommended way to handle data (ViewModels) in Web Api 2.. I have googled around quite much, and found some "recepies" but i wonder what's the most flexible and easy way of handling this..</p>
  
  <p>This call returns error --></p>
  
  <pre><code>GET http://localhost:63203/api/Gallery/GetPhotosForPage 404 (Not Found)
  </code></pre>
  
  <p>probably because of some signature error..,.</p>
  
  <p>Here is the $http call (Angular) : </p>
  
  <pre><code>var currPage = $location.path() || "Unknown"; 
  
  $http({
      method: 'GET',
      url: '/api/Gallery/GetPhotosForPage',
      accept: 'application/json',
      data: JSON.stringify(currPage)   //currpage = ex. "/leftwing"
      })
          .success(function (result) {
              console.log(result);
              $scope.mystuff= result;
          });
  </code></pre>
  
  <p>Here is the Controller GET method : /PriPhotosModel is the viewmodel...</p>
  
  <pre><code>[HttpGet]
      public object GetPhotosForPage(string currPage)
      {
          PhotoServices photoService = new PhotoServices();
          List&lt;PriPhotosModel&gt; priPhotos = photoService.GetPriPhotosForAllPhotographersOnPage(currPage);
          return Request.CreateResponse(HttpStatusCode.OK, priPhotos);
      }
  </code></pre>