示例#1
0
        public ForeCastWeather GetAllWeatherForeCastInformation(string lat, string lon, string choise = "C")
        {
            if (choise == "C")
            {
                var json = CurrentJsonForForeCastWeatherC(_foreCastLink, lat, lon);

                var deserilizedForeCastWeather = _deserializingForecastWeather
                                                 .DeserializeJson(json.Result);

                var result = deserilizedForeCastWeather;

                _wholeForeCastWeather = result;

                return(_wholeForeCastWeather);
            }
            else
            {
                var json = CurrentJsonForForeCastWeatherF(_foreCastLink, lat, lon);

                var deserilizedForeCastWeather = _deserializingForecastWeather
                                                 .DeserializeJson(json.Result);

                var result = deserilizedForeCastWeather;

                _wholeForeCastWeather = result;

                return(_wholeForeCastWeather);
            }
        }
示例#2
0
        public ForeCastWeather GetCurrentForeCastWeather(string indicator = "C", string lat = "", string lon = "")
        {
            var is_parametrsNull = this.CheckToNull(indicator, lat, lon);
            var is_Internet      = this.CheckInternetConnection();

            if (is_Internet)
            {
                if (!is_parametrsNull)
                {
                    _coordinate.FindCooordinates(lat, lon);
                    var currentLatitude  = _coordinate.Latidude;
                    var currentLontitude = _coordinate.Longtitude;

                    var currentForeCastWeatherInformation = _repository.
                                                            GetAllWeatherForeCastInformation
                                                                (currentLatitude, currentLontitude, indicator);

                    _mainForeCastObject = currentForeCastWeatherInformation;

                    return(_mainForeCastObject);
                }
                else
                {
                    throw new Exception("Some parametrs are null");
                }
            }
            else
            {
                throw new Exception("No internet exeption");
            }
        }