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

            ITemperatureService temperatureService = new TemperatureService();
            LocalTemperature    localTemp          = temperatureService.GetTemperature(ZipCode);

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

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        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);
        }