public ModifyCustomerResponse ModifyCustomer(ModifyCustomerRequest request) { ModifyCustomerResponse response = new ModifyCustomerResponse(); Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken); customer.FirstName = request.FirstName; customer.SecondName = request.SecondName; customer.Email = request.Email; ThrowExceptionIfCustomerIsInvalid(customer); _customerRepository.Save(customer); _uow.Commit(); response.Customer = customer.ConvertToCustomerDetailView(); return response; }
public ModifyCustomerResponse ModifyCustomer(ModifyCustomerRequest request) { ModifyCustomerResponse response = new ModifyCustomerResponse(); Customer customer = _customerRepository.FindBy(request.CustomerIdentityToken); var email = new EmailAddress(request.Email); var name = new Name(request.FirstName, request.SecondName); customer.ChangeEmailTo(email); customer.ChangeNameTo(name); ThrowExceptionIfCustomerIsInvalid(customer); _customerRepository.Save(customer); _uow.Commit(); response.Customer = customer.ConvertToCustomerDetailView(); return response; }