public void ActivateCandidate(Guid id, string activationCode) { var user = _userReadRepository.Get(id); user.AssertState("Activate user", UserStatuses.PendingActivation); _registrationService.Activate(id, activationCode); }
public void ActivateCandidate(string username, string activationCode) { var user = _userReadRepository.Get(username); user.AssertState("Activate user", UserStatuses.PendingActivation); var candidate = _candidateReadRepository.Get(user.EntityId); if (candidate.LegacyCandidateId == 0) { // Create candidate on legacy system before activating var legacyCandidateId = _legacyCandidateProvider.CreateCandidate(candidate); candidate.LegacyCandidateId = legacyCandidateId; _candidateWriteRepository.Save(candidate); } _registrationService.Activate(username, activationCode); }
public void ActivateCandidate(string username, string activationCode) { var user = _userReadRepository.Get(username); user.AssertState("Activate candidate", UserStatuses.PendingActivation); // Activate user before message submission so that they can continue using the site _registrationService.Activate(username, activationCode); // queue request for submission to legacy var message = new CreateCandidateRequest { CandidateId = user.EntityId }; _logService.Info("Publishing CreateCandidateRequest for Candidate with Id: {0}", message.CandidateId); _messageBus.PublishMessage(message); _logService.Info("Successfully published CreateCandidateRequest for Candidate with Id: {0}", message.CandidateId); }