//[HandleError, OrchardAuthorization(PermissionName = OrchardPermissionStrings.SiteOwner)]
 public ActionResult SetAutorefreshValue(int id, bool autorefresh)
 {
     ShowInputModel inputModel = new ShowInputModel();
     inputModel.PerformanceMonitorRecord_Id = id;
     inputModel.AutoRefresh = autorefresh;
     return RedirectToAction("Show", inputModel);
 }
        //[HandleError, OrchardAuthorization(PermissionName = OrchardPermissionStrings.SiteOwner)]
        public ActionResult Show(ShowInputModel inputModel)
        {
            int performanceMonitorRecordId = inputModel.PerformanceMonitorRecord_Id;

            ShowViewModel viewModel = _performanceMonitorWorkerService.Show(performanceMonitorRecordId);
            viewModel.PerformanceMonitorRecord_Id = performanceMonitorRecordId;

            if (inputModel.AutoRefresh == true)
            {
                viewModel.AutoRefresh = true;
            }
            else
            {
                viewModel.AutoRefresh = false;
            }

            PerformanceMonitorRecord currentMonitorRecord = _performanceMonitorWorkerService.GetPerformanceMonitorRecord(performanceMonitorRecordId);

            int maxLength = 20;
            string labelCounter = string.Empty;
            var counterNameString = currentMonitorRecord.CounterName;
            if (counterNameString.Length <= maxLength)
            {
                labelCounter = counterNameString;
            }
            else
            {
                labelCounter = Truncate(counterNameString, maxLength);
                labelCounter = string.Concat(labelCounter, "...");
            }
            viewModel.LabelCounter = labelCounter;
            viewModel.Threshold = currentMonitorRecord.Threshold;
            viewModel.ThresholdWhen = currentMonitorRecord.ThresholdWhen;
            viewModel.SampleInterval = currentMonitorRecord.SampleInterval;

            viewModel.MeanValue = currentMonitorRecord.Mean;
            viewModel.MinimumValue = currentMonitorRecord.Minimum;
            viewModel.MaximumValue = currentMonitorRecord.Maximum;

            List<PerformanceMonitorDataRecord> dataRecordsToShow = _performanceMonitorWorkerService.Plot(performanceMonitorRecordId);
            viewModel.LineName = "Countervalues";
            viewModel.LabelAxisY = currentMonitorRecord.CounterName.ToString();
            viewModel.id = 1;
            viewModel.data = new List<PlotDataViewModel>();

            foreach (PerformanceMonitorDataRecord dataRecord in dataRecordsToShow)
            {
                double valueCount = double.Parse(dataRecord.Count);
                viewModel.data.Add(new PlotDataViewModel()
                {
                    Ticks = dataRecord.Ticks,
                    Value = valueCount
                });
            }
            return View(viewModel);
        }