Example #1
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);
        }
Example #2
0
        public static void Main(string[] args)
        {
            if (args.Count() == 0)
            {
                Console.WriteLine("Usage: dotnet run 'zipCode'");
            }
            else
            {
                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);
            }
        }