I am using EF 6 in code first to make my database and can easily save new and changed data but what I would like to figure out is an easy way to figure out what data was changed when the user edits a page. This is the code I am using in the controller for my edit page:
[Route("Edit"), HttpPost, ValidateAntiForgeryToken]
public ActionResult EditSection([Bind(Include = "ID, RouteName, Type, Title, Synopsis")] Section section, HttpPostedFileBase Logo)
{
SectionAddEditVM model = new SectionAddEditVM { Section = section };
if (ModelState.IsValid)
{
db.Entry(section).State = EntityState.Modified;
db.SaveChanges();
}
return View(model);
}
The only way I could think of is pulling the data from the DB and doing a line by line comparison but that seems overly complicated.