public void Register(CustomerRegisterCommand command) { Id = Common.Common.GenerateGuid(); Code = Common.Common.GenerateCodeFromId(command.SystemNumericalOrder, 3); string passwordHash = EncryptionExtensions.Encryption(Code, command.Password, out string salt); CreatedDateUtc = command.CreatedDateUtc; CreatedUid = string.Empty; UpdatedDateUtc = command.CreatedDateUtc; UpdatedUid = string.Empty; Email = command.Email; PhoneNumber = command.Mobile; EmailConfirmed = false; IsTaxExempt = false; FailedLoginAttempts = 0; LastIpAddress = command.RegisterIp; Password = passwordHash; PasswordSalt = salt; PhoneNumberConfirmed = false; TwoFactorEnabled = EnumDefine.TwoFactorEnum.Disable; FullName = command.FullName; Gender = command.Gender; Birthday = command.Birthday; AddType(CustomerTypeEnum.IsCustomer); Status = CustomerStatusEnum.New; RegisterEvent(); }
public static CustomerRegisterCommandBuilder Start() { _command = new CustomerRegisterCommand() { Name = "Dienisson", LastName = "Almeida", Sex = Domain.Features.Flights.SexEnum.Male }; return(new CustomerRegisterCommandBuilder()); }
public void Update(CustomerRegisterCommand command) { var customer = _customerRepository.Get(command.Id); var city = _addressRepository.GetCity(command.Address.CityCode); customer.Contact.Update(command.Contact.Phone, command.Contact.CellPhone, command.Contact.Email); customer.Address.Update(command.Address.Street, command.Address.Number, command.Address.ZipCode, city); customer.Update(command.Name, command.Lastname, command.CPF); _customerRepository.Update(customer); }
public ActionResult Edit(CustomerRegisterCommand command) { try { _customerAppService.Update(command); return(RedirectToAction("Index", _customerAppService.GetAll())); } catch { return(View()); } }
public void Save(CustomerRegisterCommand command) { var customer = new Customer(command.Name , command.Lastname , command.CPF , new Contact(command.Contact.Phone, command.Contact.CellPhone, command.Contact.Email) , new Address(command.Address.Street , command.Address.Number , command.Address.ZipCode , _addressRepository.GetCity(command.Address.CityCode))); _customerRepository.Save(customer); }
private async Task <ResponseMessage> RegisterCustomer(UserRegisteredIntegrationEvent message) { var customerCommand = new CustomerRegisterCommand(message.Id, message.Name, message.Email, message.Cpf); ValidationResult success; using (var scope = _serviceProvider.CreateScope()) { var mediator = scope.ServiceProvider.GetRequiredService <IMediatorHandler>(); success = await mediator.SendCommand(customerCommand); } return(new ResponseMessage(success)); }
public ActionResult Create(CustomerRegisterCommand command) { try { _customerAppService.Save(command); return(View("Index", _customerAppService.GetAll())); } catch { return(View()); } }
public async Task <CommandResult> SendCommand(CustomerRegisterCommand command) { CommandResult commandResult = await _commandService.SendAndReceiveResult <CommandResult>(command); return(commandResult); }