Esempio n. 1
0
 public Task <Result <IEnumerable <WeatherForecast> > > CreateForecast([FromBody] NewForecastCommand model)
 {
     // One might try to perform translation from Result<T> to an appropriate IActionResult from within a MediatR pipeline
     // Unfortunately without having Result<T> depend on IActionResult there doesn't appear to be a way to do this, so this
     // example is still using the TranslateResultToActionResult filter.
     return(_mediator.Send(model));
 }
Esempio n. 2
0
 public Task <Result <IEnumerable <WeatherForecast> > > Handle(NewForecastCommand request, CancellationToken cancellationToken)
 {
     return(_weatherService.GetForecastAsync(new ForecastRequestDto {
         PostalCode = request.PostalCode
     }));
 }