Exemplo n.º 1
0
        private ParkDetailViewModel MakeDetailViewModel(string parkCode, bool useCelsius)
        {
            var vm   = new ParkDetailViewModel();
            var park = _db.GetParkByCode(parkCode);

            vm.Park     = park;
            vm.ParkCode = parkCode;
            vm.Forecast = _db.GetWeatherByParkCode(parkCode);
            if (useCelsius == true)
            {
                var converter = new TempConverter();
                foreach (var forecast in vm.Forecast)
                {
                    forecast.HighTemp = converter.FarenheitToCelsuis(forecast.HighTemp);
                    forecast.LowTemp  = converter.FarenheitToCelsuis(forecast.LowTemp);
                }
            }
            return(vm);
        }