I've got a simple WebAPI app. In my controller I have:
[HttpPost]
public ActionResult DoSomeWork(string stringParam, DTOObject dto)
{
// Some work gets done in here
}
I've got a console app doing this:
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(_context);
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = client.PostAsJsonAsync("ControllerPath/DoSomeWork", new object[]{someString, dtoObject}).Result;
I don't receive any errors. When my breakpoint is hit inside of the Controller, it shows the string coming in as NULL and the DTO coming is a fully populated but with default values (1/1/1900s, nulls, etc). I feel like the controller isn't properly deserializing the object but I'm kind of at a loss of how to fix this. Any thoughts?