How to use HttpClient to connect to an API that is expecting a custom type? <p>I have a .net controller that accepts POST events. It is expecting 2 dates from the client system(c# console app).</p> <p>How can I connect to this controller and send the needed data if the console app does not know anything about the ContestDates class?</p> <p>Here is the controller:</p> <pre><code>public class ContestDates { public DateTime FirstDate { get; set; } public DateTime SecondDate { get; set; } } [HttpPost("api/contestDates/random")] public IActionResult PostRandomDates(ContestDates contestDates) { //do stuff with contestDates... return Ok(); } </code></pre> <p>Thanks!</p>