public override void OnException(System.Web.Mvc.ExceptionContext filterContext) { base.OnException(filterContext); //OVERRIDE THE 500 ERROR filterContext.HttpContext.Response.StatusCode = 200; var errorLog = new ErrorLog { AddedDate=System.DateTime.Now, StackTrace = filterContext.Exception.StackTrace, Message = filterContext.Exception.Message }; hopeLingerieEntities.ErrorLogs.AddObject(errorLog); hopeLingerieEntities.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the ErrorLogs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToErrorLogs(ErrorLog errorLog) { base.AddObject("ErrorLogs", errorLog); }
/// <summary> /// Create a new ErrorLog object. /// </summary> /// <param name="errorLogId">Initial value of the ErrorLogId property.</param> public static ErrorLog CreateErrorLog(global::System.Int32 errorLogId) { ErrorLog errorLog = new ErrorLog(); errorLog.ErrorLogId = errorLogId; return errorLog; }