Last active
November 12, 2021 10:51
-
-
Save umayeras/48d33d7e0d7e2c004a05be277ba27b06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class GetSampleByIdHandler : IRequestHandler<GetSampleByIdQuery, ServiceResponse> | |
{ | |
private readonly IReadOnlyRepository<Sample> repository; | |
public GetSampleByIdHandler(IReadOnlyRepository<Sample> repository) | |
{ | |
this.repository = repository; | |
} | |
public async Task<ServiceDataResponse> Handle(GetSampleByIdQuery request, CancellationToken cancellationToken) | |
{ | |
var sample = await repository.GetSingleAsync(x => x.Id == request.Id); | |
return ServiceDataResponse.Ok(sample); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment