public CustomerCreate() { _customer = new Domain.Customer.Customer( new CustomerId(Guid.NewGuid()), FullName.FromString("ST Skolebyg"), Adresse.FromString("Vardevej 98", 7100, "Vejle"), PhoneNo.FromInt(22222222), Email.FromString("*****@*****.**"), CustomerType.FromString(1.ToString()) ); }
public Task Handle(object command) { return(command switch { V1.RegisterCustomer cmd => HandleCreate(cmd), V1.UpdateCustomerFullName cmd => HandleUpdate(cmd.CustomerId, profile => profile.UpdateName(FullName.FromString(cmd.FullName))), V1.UpdateCustomerEmail cmd => HandleUpdate( cmd.CustomerId, profile => profile.UpdateEmail( Email.FromString(cmd.Email) ) ), V1.UpdateCustomerAdresse cmd => HandleUpdate( cmd.CustomerId, profile => profile.UpdateAdresse( new Adresse(Street.FromString(cmd.Street), ZipCode.FromInt(cmd.ZipCode), City.FromString(cmd.City)) ) ), V1.ChangeCustomerType cmd => HandleUpdate( cmd.CustomerId, profile => profile.ChangeCustomerType( CustomerType.FromString(cmd.CustomerType.ToString()) ) ), V1.UpdateCustomerPhoneNo cmd => HandleUpdate( cmd.CustomerId, profile => profile.UpdatePhoneNo( PhoneNo.FromInt(cmd.PhoneNo) ) ), V1.DeleteCustomer cmd => HandleUpdate( cmd.CustomerId, profile => profile.DeleteCustomer( IsDeleted.FromBool(cmd.IsDeleted) ) ), _ => Task.CompletedTask });