Пример #1
0
        private static void CreateAccount(Guid correlationId)
        {
            var accountCreation = new AccountDetailsProvided(correlationId)
            {
                Username             = "******",
                Password             = "******",
                PasswordConfirmation = "james is awesome",
            };

            var excutionResult = _sagaMediator.Consume(accountCreation);

            if (!excutionResult.IsSuccessful)
            {
                Console.WriteLine(excutionResult.ToString());
            }
        }
Пример #2
0
        public OperationResult Consume(AccountDetailsProvided message)
        {
            if (!SagaData.IsVerificationCodeMatched)
            {
                throw new Exception("Verification Code has not been matched. How did you get here?");
            }

            if (message.Password != message.PasswordConfirmation)
            {
                return(new OperationResult("Password confirmation does not match the password"));
            }

            //TODO create user, saga has finished.

            return(new OperationResult());
        }