I have the following code in my HomeController:
public ActionResult Edit(int id)
{
var ArticleToEdit = (from m in _db.ArticleSet where m.storyId == id se
I had the same problem, unfortunately, I have two DateTime property on my model and one DateTime property is null before I do SaveChanges.
So make sure your model has DateTime value before saving changes or make it nullable to prevent error:
public DateTime DateAdded { get; set; } //This DateTime always has a value before persisting to the database.
public DateTime ReleaseDate { get; set; } //I forgot that this property doesn't have to have DateTime, so it will trigger an error
So this solves my problem, its a matter of making sure your model date is correct before persisting to the database:
public DateTime DateAdded { get; set; }
public DateTime? ReleaseDate { get; set; }