Example #1
0
 public JsonResult GetLogs(DateTime startDateTime, DateTime endDateTime)
 {
     try
     {
         var logsManager = new LogsManager();
         var logs        = logsManager.GetLogs(startDateTime, endDateTime);
         return(new JsonResult {
             Data = logs.Select(x => new { x.Id, x.Level, x.Date, x.Source, x.Thread, x.HostName, x.User, x.Logger, x.Message, x.Exception }), MaxJsonLength = Int32.MaxValue, JsonRequestBehavior = JsonRequestBehavior.AllowGet
         });
     }
     catch (Exception exception)
     {
         while (exception.InnerException != null)
         {
             exception = exception.InnerException;
         }
         Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
         return(Json(exception.Message, JsonRequestBehavior.AllowGet));
     }
 }