title: How to get model data from PostAsync?
body: <p>I have just start some R&amp;D on integrating an MVC application that calls a WebApi, both of which I am writing. The WebApi will be called by different applications eventually so I want to have to business logic in here.</p>
  
  <p>I have created the following simple method on my API server:</p>
  
  <pre><code>[HttpPost]
  public HttpResponseMessage Get(ShipmentGetCarrierModel view)
  {
      var response = Request.CreateResponse&lt;ShipmentGetCarrierModel&gt;(HttpStatusCode.OK, view);
      return response;
  
      //return new HttpResponseMessage(HttpStatusCode.OK);
  }
  </code></pre>
  
  <p>I am calling this method from my MVC application as follows:</p>
  
  <pre><code>public ActionResult GetOrderNumber2(int orderNumber)
  {
      using (var apiServer = new HttpClient())
      {
          apiServer.BaseAddress = new Uri("http://localhost:52126");
          apiServer.DefaultRequestHeaders.Accept.Clear();
          apiServer.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
          ShipmentGetCarrierModel model = new ShipmentGetCarrierModel();
          model.nOrderNumber = 100;
  
          // New code:
          HttpResponseMessage response =
              apiServer.PostAsync("api/PC/Get",
              model,
          new JsonMediaTypeFormatter()).Result;
  
  
          if (response.IsSuccessStatusCode)
          {
              return Content(response.Content.ToString());
          }
      }
  
      return Content("NOT  " + orderNumber.ToString());
  }
  </code></pre>
  
  <p>My model which is identical for both applications is:</p>
  
  <pre><code>public class ShipmentGetCarrierModel
  {
      public int nID { get; set; }
      public int nOrderNumber { get; set; }
      public string cConsigneeName { get; set; }
      public string cCarrierCode { get; set; }
      public string cConsigneeAddress1 { get; set; }
      public string cConsigneeAddress2 { get; set; }
      public string cConsigneeCity { get; set; }
      public string cConsigneeProvince { get; set; }
      public string cConsigneePostalCode { get; set; }
      public string cConsigneeTelephone { get; set; }
      public string cConsigneeContact { get; set; }
      public string cConsigneeCountry { get; set; }
      public Boolean? lIsPharmilink { get; set; }
  }
  </code></pre>
  
  <p>I am getting the response code but I cannot see the model data that is returned in the debugger that is created by the WebAPI.</p>
  
  <p>Ironically when I analyse the call using Fiddler, I see my model with their null values.</p>
  
  <p><a href="https://i.stack.imgur.com/hwM8v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hwM8v.png" alt="Fiddler Image"></a></p>
  
  <p>Obviously I am missing something here.
  TIA
  Mark</p>