public void InsertLogMessage(string logMessage) { tbl_Error tblError = new tbl_Error(); tblError.ErrorMessage = logMessage; tblError.ErrorTime = DateTime.Now; db.tbl_Error.Add(tblError); db.SaveChanges(); }
public int InsertLog(IDictionary <string, object> data) { tbl_Error tblError = new tbl_Error(); tblError.ErrorMessage = data["ErrorMessage"].ToString(); tblError.ErrorTime = DateTime.Now; db.tbl_Error.Add(tblError); db.SaveChanges(); return(1); }
public void OnException(ExceptionContext filterContext) { string route = filterContext.RouteData.Route.ToString(); string logMessage = "Error In :" + route + " Inner Exception " + filterContext.Exception.InnerException + "Message :" + filterContext.Exception.Message + "Stack Trace : " + filterContext.Exception.StackTrace; tbl_Error tblError = new tbl_Error(); tblError.ErrorMessage = logMessage; tblError.ErrorTime = DateTime.Now; db.tbl_Error.Add(tblError); db.SaveChanges(); filterContext.ExceptionHandled = true; }