public GetWeatherResponse GetWeather(GetWeatherRequest req)
        {
            var resp    = new GetWeatherResponse();
            var r       = new Random();
            int celsius = r.Next(-20, 50);

            if (req.TemperatureType == TemperatureType.Celsius)
            {
                resp.Temperature = celsius;
            }
            else
            {
                resp.Temperature = (212 - 32) / 100 * celsius + 32;
            }

            if (req.City == "Redmond")
            {
                resp.Condition = TemparatureCondition.Rainy;
            }
            else
            {
                resp.Condition = (TemparatureCondition)r.Next(0, 3);
            }

            return(resp);
        }
Beispiel #2
0
        public GetWeatherResponse GetWeather(GetWeatherRequest req)
        {
            var resp = new GetWeatherResponse();
            var r = new Random();
            int celsius = r.Next(-20, 50);

            if (req.TemperatureType == TemperatureType.Celsius)
                resp.Temperature = celsius;
            else
                resp.Temperature = (212 - 32) / 100 * celsius + 32;

            if (req.City == "Redmond")
                resp.Condition = TemparatureCondition.Rainy;
            else
                resp.Condition = (TemparatureCondition)r.Next(0, 3);

            return resp;
        }
        public GetWeatherResponse GetWeather(GetWeatherRequest req)
        {
            var resp = new GetWeatherResponse();
            var r = new Random();

            int celsius = r.Next(-20, 50);

            if(req.TemperatureType == TemperatureType.Celsius) {
                resp.Temperature = celsius;
            } else {
                resp.Temperature = (212 - 32) / 100 * celsius + 32;
            }

            if(req.City == "St. Louis") {
                resp.Condition = TemperatureCondition.Rainy;
            } else {
                resp.Condition = (TemperatureCondition)r.Next(0, 3);
            }

            return resp;
        }