Skip to content

Instantly share code, notes, and snippets.


explorer14/CustomerRegUseCase.cs Secret

Last active Jun 13, 2020
What would you like to do?
public class CustomerRegistrationUseCase
public async Task RegisterCustomer(
CustomerRegistrationRequest customerRegistrationRequest)
var customer = await registeredCustomers.GetByEmail(
if (customer == null)
var newCustomer = customerRegistrationRequest.ToNewCustomer();
await registeredCustomers.Add(newCustomer);
await eventBus.Publish(
new NewCustomerRegistered(newCustomer)));
throw new CustomerAlreadyExists(customer);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment