title: Automapper in WebAPI Controller
body: <p>I have a Car WebAPI controller method as below - note _carService.GetCarData returns a collection of CarDataDTO objects</p>
  
  <pre><code>[HttpGet]
  [Route("api/Car/Retrieve/{carManufacturerID}/{year}")]
  public IEnumerable&lt;CarData&gt; RetrieveTest(int carManufacturerID, int year)
  {
      //Mapper.Map&lt;&gt;
      var cars = _carService.GetCarData(carManufacturerID, year);
      //var returnData = Mapper.Map&lt;CarData, CarDataDTO&gt;();
      return cars;
  }
  </code></pre>
  
  <p>CarData is a WebAPI model I have created.</p>
  
  <pre><code>public class CarData
  {
      public string Model { get; set; }
      public string Colour { get; set; }
      //other properties removed from brevity
  }
  </code></pre>
  
  <p>CarDataDTO is a class I have created that models the DB Table - I retrieve the Data via a stored proc called with dapper.</p>
  
  <pre><code>public class CarDataDTO
  {
      public int CarID { get; set; }
      public int CarManufacturerID { get; set; }
      public int Year { get; set; }
      public string Model { get; set; }
      public string Colour { get; set; }
      //other properties removed from brevity
  }
  </code></pre>
  
  <p>If I have a breakpoint on the var cars line in my API controller I can see everything returned as expected and I have a collection of CarDTO objects.  However, I don't require the WebAPI to return the CarDataID, CarID or Year which is why I created the CarData API model.</p>
  
  <p>How can I easily use Automapper to only map the properties I am concerned with?</p>
  
  <p>Do I need something set up in my WebApiConfig class?</p>