コード例 #1
0
        public void Handle(RegisterSmsGateway command)
        {
            var apiKey = new StringBuilder();

            using (var hash = SHA256.Create())
            {
                var key    = Encoding.UTF8.GetBytes(System.Guid.NewGuid().ToString("N"));
                var result = hash.ComputeHash(key);

                foreach (var b in result)
                {
                    apiKey.Append(b.ToString("x2"));
                }
            }

            var root = _repository.Get(command.SmsGatewayId.Value);

            root.RegisterSmsGateway(command.Name, apiKey.ToString());
        }
コード例 #2
0
        public void Handle(RegisterSmsGateway command)
        {
            var root = _repository.Get(command.SmsGatewayId.Value);

            root.RegisterSmsGateway(command.Name, command.ApiKey);
        }