//public ActionResult Create([Bind(Include = "ID,UserId,Date,Event")] Audit audit) public ActionResult Create([Bind(Include = "ID,UserId,Date,Event")] Audit audit) { if (ModelState.IsValid) { db.AuditLog.Add(audit); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(audit)); }
public int DataContextSaveChanges() { try { if (LoggedInUser != null) { return(AuditDBContext.SaveChanges(LoggedInUser)); } else { return(AuditDBContext.SaveChanges()); } } catch (System.Data.Entity.Validation.DbEntityValidationException error) { SendError(error); throw; } catch (System.Data.Entity.Infrastructure.DbUpdateException err) { SendError(err); throw; } }