public ActionResult Results() { List <ParkModel> parks = parkDAL.GetAllParks(); Dictionary <string, ParkModel> parksDict = new Dictionary <string, ParkModel>(); List <SurveyResultModel> parksSurveyResults = new List <SurveyResultModel>(); foreach (ParkModel park in parks) { // Add key-value pair to parksDict parksDict[park.ParkCode] = park; // Add to parksSurveyResults SurveyResultModel results = surveyDAL.GetParkSurveyResults(park.ParkCode); if (results.NumSurveys >= 1) { parksSurveyResults.Add(results); } } ParkSurveyResultViewModel surveySummaries = new ParkSurveyResultViewModel(); surveySummaries.ParksDict = parksDict; surveySummaries.ParksSurveyResults = parksSurveyResults.OrderBy(p => p.NumSurveys).Reverse().ToList(); return(View("Results", surveySummaries)); }