Skip to content

Instantly share code, notes, and snippets.

@DavidRogersDev
Last active April 18, 2020 23:22
Show Gist options
  • Save DavidRogersDev/c29df0b6e17adc85786e033e15e25e43 to your computer and use it in GitHub Desktop.
Save DavidRogersDev/c29df0b6e17adc85786e033e15e25e43 to your computer and use it in GitHub Desktop.
Gist for Medium Article - GetColorsQueryHandler
public class GetColorsQueryHandler : IRequestHandler<GetColorsQuery, Either<IEnumerable<ColorPayloadDto>, ValidationResult>>
{
private readonly IColorsService _colorsService;
public GetColorsQueryHandler(IColorsService colorsService)
{
_colorsService = colorsService;
}
public async Task<Either<IEnumerable<ColorPayloadDto>, ValidationResult>> Handle(GetColorsQuery request, CancellationToken cancellationToken)
{
return await _colorsService.GetColorsAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment