public IEnumerable <HistoryException> GetExceptions() { var repository = new HistoryExceptionRepository(); var items = repository.Get(); return(items); }
public void Log(string section, Exception ex, int?userId = null) { var repository = new HistoryExceptionRepository(); userId = userId ?? this.SessionService.CurrentUserId; var item = new HistoryException { Section = section, ExceptionType = ex.GetType().FullName, ExceptionSource = ex.Source, ExceptionMessage = ex.Message, ExceptionStackTrace = ex.StackTrace, UserId = userId, DateLogged = DateTime.Now }; repository.New(item); if (ex.InnerException != null) { this.Log(section, ex.InnerException); } }