using Books.Api.Domain.Customers; using EventFlow.Commands; namespace Books.Api.Commands.Customers; public class CreateCustomerCommandHandler : CommandHandler { public override Task ExecuteAsync( CustomerAggregate aggregate, CreateCustomerCommand command, CancellationToken cancellationToken) { aggregate.Create( command.CompanyId, command.CustomerNumber, command.CustomerType, command.Name, command.Cvr, command.Address, command.PostalCode, command.City, command.Country, command.Email, command.Phone, command.PaymentTermsDays, command.DefaultRevenueAccountId, command.SubLedgerAccountId); return Task.CompletedTask; } } public class UpdateCustomerCommandHandler : CommandHandler { public override Task ExecuteAsync( CustomerAggregate aggregate, UpdateCustomerCommand command, CancellationToken cancellationToken) { aggregate.Update( command.Name, command.Cvr, command.Address, command.PostalCode, command.City, command.Country, command.Email, command.Phone, command.PaymentTermsDays, command.DefaultRevenueAccountId); return Task.CompletedTask; } } public class DeactivateCustomerCommandHandler : CommandHandler { public override Task ExecuteAsync( CustomerAggregate aggregate, DeactivateCustomerCommand command, CancellationToken cancellationToken) { aggregate.Deactivate(); return Task.CompletedTask; } } public class ReactivateCustomerCommandHandler : CommandHandler { public override Task ExecuteAsync( CustomerAggregate aggregate, ReactivateCustomerCommand command, CancellationToken cancellationToken) { aggregate.Reactivate(); return Task.CompletedTask; } }