Skip to content

Instantly share code, notes, and snippets.

@dcomartin
Last active May 26, 2021 21:46
Show Gist options
  • Save dcomartin/056a90f7a31b9118ec4c831cc587cc2d to your computer and use it in GitHub Desktop.
Save dcomartin/056a90f7a31b9118ec4c831cc587cc2d to your computer and use it in GitHub Desktop.
public class GetProductBySkuHandler : IRequestHandler<GetProductBySkuRequest, ProductViewModel>
{
private readonly IProductService _productService;
public GetProductBySkuHandler(IProductService productService)
{
_productService = productService;
}
public async Task<ProductViewModel> Handle(GetProductBySkuRequest request, CancellationToken cancellationToken)
{
var product = await _productService.GetProductBySku(request.Sku);
return product.ToViewModel();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment