Esempio n. 1
0
 public Forecast(ThermometricScales scale, DateTime date, float minTemperature, float maxTemperature)
 {
     Scale = scale;
     Date  = date;
     this.minTemperature = new Temperature(minTemperature);
     this.maxTemperature = new Temperature(maxTemperature);
 }
Esempio n. 2
0
        public async Task <IActionResult> GetWeatherForecast(int locationId, [FromQuery] ThermometricScales scale)
        {
            var result = await getWeatherByLocationUseCase.Execute(locationId, scale);

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

            if (result.Forecasts == null || !result.Forecasts.Any())
            {
                return(NoContent());
            }

            return(Ok(result));
        }
        public async Task <Weather> Execute(int locationId, ThermometricScales scale)
        {
            var weatherForecast = await weatherService.GetWeatherForecast(locationId);

            return(mapper.Map <Weather>((weatherForecast, scale)));
        }
 public double Evaluate(ThermometricScales scale) => scale switch
 {
Esempio n. 5
0
 public Weather(ThermometricScales scale, Location location, IEnumerable <Forecast> forecasts)
 {
     Scale     = scale;
     Location  = location;
     Forecasts = forecasts;
 }