Example #1
0
        public async Task <ICollection <WeatherForecastData> > ListWeatherForecasts()
        {
            var request = new ListWeatherForecastRequest();

            var response = await _client.ListWeatherForecastsAsync(request);

            return(response.Forecasts.Select(f => _mapper.Map <WeatherForecast, WeatherForecastData>(f)).ToList());
        }
Example #2
0
        public override async Task <ListWeatherForecastsResponse> ListWeatherForecasts(ListWeatherForecastRequest request, ServerCallContext context)
        {
            var forecasts = await _repository.ListWeatherForecasts();

            var results = forecasts.Select(f => _mapper.Map <WeatherForecastStoredData, WeatherForecast>(f));

            return(new ListWeatherForecastsResponse
            {
                Forecasts = { results }
            });
        }