How to pass model object to Web API Post method
<p>I want to save data to database in MVC application. I have below class which calls the webapi1 service post method. Here Sample is a model object. I have a view which uses the Sample object. I want to inert the Sample Object data to db using the service call.</p>

<pre><code>public SampleTestCreate(Sample)
{
    string uri = baseUri + "Test";
    using (HttpClient httpClient = new HttpClient())
    {
        Task&lt;HttpResponseMessage&gt; response = httpClient.PostAsJsonAsync(uri, new StringContent(JsonConvert.SerializeObject(Test)));
      //  Task&lt;HttpResponseMessage&gt; response = httpClient.PostAsJsonAsync(uri, Test);
        var data = response.Result.Content.ReadAsStringAsync().Result;
       return JsonConvert.DeserializeObjectAsync&lt;Test&gt;(response.Result.Content.ReadAsStringAsync().Result).Result;
     }
}

// POST api/Sample
public HttpResponseMessage PostSample(Sample Sample)
{
    if (ModelState.IsValid)
    {
        db.Samples.Add(Sample);
        db.SaveChanges();

        HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, Sample);
        response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = Sample.SampleID }));
        return response;
    }
    else
    {
        return Request.CreateResponse(HttpStatusCode.BadRequest);
    }
}
</code></pre>

<p>Here my service post method is getting called , but the "Sample" objects all the properties values are coming null. The model object binding is not happening.</p>