Skip to content

Instantly share code, notes, and snippets.

@babaktaremi
Created January 18, 2021 14:39
Show Gist options
  • Save babaktaremi/28f5cd4f1424097a0f0e908aa235dc15 to your computer and use it in GitHub Desktop.
Save babaktaremi/28f5cd4f1424097a0f0e908aa235dc15 to your computer and use it in GitHub Desktop.
namespace MediatRExploration.Application.BookApplication.GetBookById
{
public class GetBookByIdRequestHandler:IRequestHandler<GetBookByIdRequest,Book>
{
private readonly IBookRepository _bookRepository;
public GetBookByIdRequestHandler(IBookRepository bookRepository)
{
_bookRepository = bookRepository;
}
public Task<Book> Handle(GetBookByIdRequest request, CancellationToken cancellationToken)
{
return Task.FromResult(_bookRepository.GetBookById(request.BookId));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment