I have this field in my model :
public DateTime ATime{ get; set; }
On Create Controller, I can pick a date using datepicker and it successfully creates.
But when I try to Edit the object, I get the exception in the title. My Edit code is default Edit code :
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit([Bind(Include="AID,ATime")] Project project)
{
if (ModelState.IsValid)
{
db.Entry(project).State = EntityState.Modified;
db.SaveChanges(); // I get exception at this line.
return RedirectToAction("Index");
}
return View(project);
}
How can I get rid of this exception? Thanks.