public IActionResult Index() { storageHelper = new AzureStorageHelper( _iconfiguration["AzureStorage:AZ_StorageConnectionString"], _iconfiguration["AzureStorage:AZ_StorageContainerName"]); var blobArray = storageHelper.GetBlobNamesFromAzureStorage(); var stringList = blobArray == null ? new List <string>() : blobArray.ToList <string>(); List <FilteredData> filteredDataList = new List <FilteredData>(); foreach (string blobName in stringList) { filteredDataList.AddRange(CSVParserHelper.GenerateFilteredDataFromCsv(storageHelper.DownloadBlobFromAzureStorage(blobName))); } double temperatureSum = 0; double humiditySum = 0; ViewBag.Issues = 0; foreach (var filteredData in filteredDataList) { temperatureSum += filteredData.Temperature; humiditySum += filteredData.Humidity; if (filteredData.IsAnomaly) { ViewBag.Issues++; } } // ToDo: Calculate Average Temperature and Humidity ViewBag.AverageTemperature = string.Format("{0:0.000}", filteredDataList == null || filteredDataList.Count == 0 ? 0 : temperatureSum / filteredDataList.Count); ViewBag.AverageHumidity = string.Format("{0:0.000}", filteredDataList == null || filteredDataList.Count == 0 ? 0 : humiditySum / filteredDataList.Count); return(View(filteredDataList)); }
public IActionResult Index() { storageHelper = new AzureStackStorageHelper( _iconfiguration["AzureStackStorage:AzS_StorageEndPoint"], _iconfiguration["AzureStackStorage:AzS_StorageAccount"], _iconfiguration["AzureStackStorage:AzS_StorageKey"], _iconfiguration["AzureStackStorage:AzS_StorageContainerName"]); var stringArray = storageHelper.GetBlobNamesFromAzureStorage(); var stringList = new List <string>(); if (stringArray != null) { stringList = stringArray.ToList <string>(); } List <UnfilteredData> unfilteredDataList = new List <UnfilteredData>(); foreach (string blobName in stringList) { unfilteredDataList.AddRange(CSVParserHelper.GenerateUnfilteredDataFromCsv(storageHelper.DownloadBlobFromAzureStorage(blobName))); } ViewBag.TotalRecords = unfilteredDataList.Count; ViewBag.TotalIssues = 0; foreach (var data in unfilteredDataList) { if (data.IsAnomaly) { ViewBag.TotalIssues++; } } return(View(unfilteredDataList)); }