Exemple #1
0
        public async Task <bool> Register(string number)
        {
            Number = null;
            UserId = null;
            var request = new RegistrationRequest {
                Number = number
            };
            var commandRequest = _commandBuilder.Create(CommandName.Register, request);
            var commandReply   = await _transportManager.SendCommandAndGetAnswerAsync(commandRequest);

            var result = _commandBuilder.GetUnderlyingObject <RegistrationResult>(commandReply);

            if (result.Result == RegistrationResultType.Success)
            {
                _storage.SetValue(NumberKey, number);
                _storage.SetValue(UserIdKey, result.UserId);
                Number = number;
                UserId = result.UserId;
                return(true);
            }
            return(false);
        }
 public ValueModel SetValue(KeyModel key, ValueModel value) => _storage.SetValue(key, value);
Exemple #3
0
 private void SetValue(string key, string value)
 {
     storage.SetValue(MakeKey(key), value);
 }