private void Execute(RemoveCustomer command) { var customer = _aggregateEventStore.GetAggregate <Customer>(command.Id); customer.Remove(); _aggregateEventStore.Save(customer); }
/// <inheritdoc cref="RemoveCustomerAsync(Commands.RemoveCustomer, CancellationToken)"/> public CustomerResponse RemoveCustomer(RemoveCustomer removeCustomer) => Post <RemoveCustomer, CustomerResponse>(removeCustomer);
/// <summary> /// /// </summary> /// <param name="removeCustomer"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public Task <CustomerResponse> RemoveCustomerAsync(RemoveCustomer removeCustomer, CancellationToken cancellationToken) => PostAsync <RemoveCustomer, CustomerResponse>(removeCustomer, cancellationToken);
public Task <Unit> Handle(RemoveCustomer request, CancellationToken cancellationToken) { _customersRepository.RemoveAsync(request.Id); Commit(); return(Unit.Task); }
public async Task HandleAsync(RemoveCustomer command) { await ExecuteAsync(command.CustomerId, model => model.Remove()); }