Last active
January 5, 2021 17:50
-
-
Save babaktaremi/f25978fcd4b4600c9a597901b3b1b7b2 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
//Command Model | |
public class CreateCustomerCommandHandler : IRequestHandler<CreateCustomerCommand, Customer> | |
{ | |
private readonly ICustomerRepository _customerRepository; | |
public CreateCustomerCommandHandler(ICustomerRepository customerRepository) | |
{ | |
_customerRepository = customerRepository; | |
} | |
public async Task<Customer> Handle(CreateCustomerCommand request, CancellationToken cancellationToken) | |
{ | |
return await _customerRepository.AddAsync(request.Customer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment