コード例 #1
0
ファイル: Function1.cs プロジェクト: ikkedus/BierRapport
        public static void Run([QueueTrigger("requestbierrapport", Connection = "")] string myQueueItem, ILogger log)
        {
            var    item     = JsonConvert.DeserializeObject <LocationQueueItem>(myQueueItem);
            var    forecast = OpenWeatherHelper.getForecastFor(item.city, item.country);
            var    image    = AzureMapsHelper.getImage(new Tuple <double, double>(forecast.coord.lat, forecast.coord.lon));
            string text2    = "Mooi weer voor bier";

            if (forecast.main.temp < 18)
            {
                text2 = "slecht weer voor bier";
            }

            var editedImage = ImageHelper.AddTextToImage(image, ("het is " + forecast.main.temp.ToString() + " graden buiten", (10, 20)), (text2, (150, 300)));

            CloudStoarge.upload(item.id + ".png", editedImage as MemoryStream);
        }
コード例 #2
0
        public IActionResult Index(WeatherViewModel model)
        {
            var weather = new WeatherViewModel();

            if (ModelState.IsValid)
            {
                if (model.SelectedCity != null)
                {
                    var weatherReport = OpenWeatherHelper.GetWeather(model.SelectedCity);
                    weather.Temperature        = weatherReport.Temperatures;
                    weather.Pressure           = weatherReport.Pressure;
                    weather.Humidity           = weatherReport.Humidity;
                    weather.Wind               = weatherReport.Winds;
                    weather.SummaryDescription = weatherReport.Description;
                }
            }

            return(View(weather));
        }