title: Asp.net core MVC DatatTypes in model and null values
body: <p>I have simple model MyModel:</p>
  
  <pre><code>[Key]
  public int Id { get; set; }
  public string 1stString { get; set; }
  public string 2ndString { get; set; }
  public string 3rdString { get; set; }
  [DataType(DataType.Date)]
  public DateTime MyDate { get; set; }
  </code></pre>
  
  <p>In my controller I then have: </p>
  
  <pre><code>[HttpGet]
  public async Task&lt;IActionResult&gt; MyView(int? id)
  {
      var model = await _db.MyModel.ToListAsync(); ///HERE IT THROWS ERROR
      ViewBag.Id = id ?? 1;
      return View(model);
  }
  </code></pre>
  
  <p>I have problem that I have Null values in my Db so it automatically throws <a href="https://i.stack.imgur.com/xiTY9.png" rel="nofollow noreferrer">this error</a> because of datetime I suppose?</p>