Exemplo n.º 1
0
        public async Task <IActionResult> GetCityByNameAndCode(string name, string code)
        {
            var cityFromRepo = await _service.GetCityByNameAndCodeAsync(name, code);

            if (cityFromRepo == null)
            {
                return(NotFound());
            }

            cityFromRepo.Weather = InfraData.GetCityWeather(name, code);
            //_logger.LogWarning($"Country: {cityFromRepo.Country}, Weather:{cityFromRepo.Weather}");
            Log.Warning("Country: {0}, Weather:{1}", cityFromRepo.Country, cityFromRepo.Weather);
            return(Ok(cityFromRepo));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> ListCities()
        {
            var cities = await _service.ListCitiesAsync();

            if (cities != null)
            {
                foreach (var city in cities)
                {
                    city.Weather = InfraData.GetCityWeather(city.Name, city.Alpha2Code);
                }

                return(Ok(cities));
            }

            return(NotFound());
        }
Exemplo n.º 3
0
    public void ShowInfraData(InfraData infraData)
    {
        this.infraData = infraData;

        if (infraData.foodLvl != -1)
        {
            infraFoodValue.text = "" + infraData.foodLvl + " lvl";
            infraProdValue.text = "" + infraData.prodLvl + " lvl";
        }
        else
        {
            infraFoodValue.text = "???";
            infraProdValue.text = "???";
        }

        infraFoodLevelUpButton.interactable = infraData.isFoodUpAvailable();
        infraProdLevelUpButton.interactable = infraData.isProdUpAvailable();
    }