title: How to send JSON date fields to web core API?
body: <p>I have this AJAX request;</p>
  
  <pre><code>   addDataToDatabase = function (callback, errorCallback, url, data) {
          $.ajax({
              async: true,
              url: url,
              contentType: "application/json",
              dataType: "text",
              data: data,
              type: "POST"
          })
              .done(function (data) {
                  callback(data);
              })
              .fail(function (data) {
                  errorCallback(data);
              });
  </code></pre>
  
  <p>which sends data to the web core API;</p>
  
  <blockquote>
    <p>data  "{\"InspectionId\":\"4471\",\"DateOfVisit\":\"25/09/2017
    00:00:00\",\"NoAccessId\":\"2\",\"NoAccessComment\":\"lkjh
    lkjhlkjhlkhjlkjhlklkjh lkh lkh kjh dsf\"}"</p>
  </blockquote>
  
  <p>Which is pick up with this method</p>
  
  <pre><code>[HttpPost("addNoAccess")]
          public async Task&lt;IActionResult&gt; AddNoAccessVisit([FromBody] InspectionVisitNoAccessDto noAccessVisit)
  </code></pre>
  
  <p>The definition of the dto is</p>
  
  <pre><code>public class InspectionVisitNoAccessDto
      {
          public int InspectionId { get; set; }
          public DateTime DateOfVisit { get; set; }
          public int NoAccessId { get; set; }
          public string NoAccessComment { get; set; }
  
          public override string ToString()
          {
              return $"No Access Inspection Visit, date of visit {DateOfVisit.ToLongDateString()}, id = {NoAccessId}, comment = {NoAccessComment}";
          }
      }
  </code></pre>
  
  <p>The DateOfVisit field is a date field. With the this definition, the input string for the date field does not appear to be converted from a string to a date field, as the whole object is null.
  But if I change the definition from DateTime to string, everything is fine.
  But I would prefer to keep the definition as it is. Is there something with the JSON input I can do to fix this?</p>