Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            const string zipCode = "83714";

            var temperatureFacade      = new TemperatureLookupFacade();
            LocalTemperature localTemp = temperatureFacade.GetTemperature(zipCode);

            Console.WriteLine("The current temperature is {0}F/{1}C. in {2}, {3}",
                              localTemp.Farenheit.ToString("F1"),
                              localTemp.Celcius.ToString("F1"),
                              localTemp.City,
                              localTemp.State);

            Console.ReadKey();
        }
        public LocalTemperature GetTemperature(string zipCode)
        {
            var coords = geoLookupService.GetCoordinatesForZipCode(zipCode);
            var city   = geoLookupService.GetCityForZipCode(zipCode);
            var state  = geoLookupService.GetStateForZipCode(zipCode);

            var farenheit = weatherService.GetTempFarenheit(coords.Latitude, coords.Longitude);
            var celcius   = converter.FarenheitToCelcious(farenheit);

            var localTemperature = new LocalTemperature()
            {
                Farenheit = farenheit,
                Celcius   = celcius,
                City      = city,
                State     = state
            };

            return(localTemperature);
        }