How can I POST a complex type to a Web Api 2 controller action, from a C# client? I see a lot of information about it but for older versions of the framework. What's the correct way to do it in .NET 4.5.1?
At the moment I have:
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://localhost:60892/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
//client.PostAsJsonAsync() doesn't seem to exist or I am missing something
//client.PostAsync() can't find a way to post a complex type
if (response.IsSuccessStatusCode)
{
}
}