public List <WeatherModel> GetWeatherForecast(string parkCode) { List <WeatherModel> forecast = new List <WeatherModel>(); string getForecastSql = "SELECT fiveDayForecastValue, low, high," + " forecast FROM weather WHERE parkCode = @parkCode;"; using (SqlConnection conn = new SqlConnection(_connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand(getForecastSql, conn); cmd.Parameters.AddWithValue("@parkCode", parkCode); var reader = cmd.ExecuteReader(); while (reader.Read()) { WeatherModel dayForecast = new WeatherModel(); dayForecast.ForecastValue = Convert.ToInt32(reader["fiveDayForecastValue"]); dayForecast.TempLow = Convert.ToInt32(reader["low"]); dayForecast.TempHigh = Convert.ToInt32(reader["high"]); dayForecast.Forecast = Convert.ToString(reader["forecast"]); dayForecast.GenerateAdvice(); forecast.Add(dayForecast); } } return(forecast); }