public List <CSSR_Result_ViewModel> getCSSR(int[] operators, int[] technologies , DateTime?fromDate, DateTime?toDate) { List <CSSR_Result_ViewModel> data_for_all_operator_technology = new List <CSSR_Result_ViewModel>(); foreach (var selected_operator_id in operators) { Operator selectedOperator = _operatorService.FindOperatorAsync(selected_operator_id).Result; foreach (var selected_technology_id in technologies) { Technology selectedTechnology = _technologyService.FindTechnologyAsync(selected_technology_id).Result; List <CSSR_Result_ViewModel> data_for_one_operator_technology = new List <CSSR_Result_ViewModel>(); if (fromDate.HasValue && toDate.HasValue) { data_for_one_operator_technology = _dataGatheringService.getCSSR(selectedOperator, selectedTechnology, fromDate.Value, toDate.Value); } else { data_for_one_operator_technology = _dataGatheringService.getCSSR(selectedOperator, selectedTechnology); } data_for_all_operator_technology.AddRange(data_for_one_operator_technology); } } double request = data_for_all_operator_technology .Sum(s => s.MM_CMServiceRequest); double response = data_for_all_operator_technology .Sum(s => s.RANAP_RABAssignment_Response); double CSSR = 0; if (response != 0) { CSSR = (double)response / (double)request; } return(data_for_all_operator_technology); }