Esempio n. 1
0
        public async Task <IClientAccount> GetByIdAsync(string id)
        {
            var partitionKey = ClientAccountEntity.GeneratePartitionKey();
            var rowKey       = ClientAccountEntity.GenerateRowKey(id);

            return(await _tradersTableStorage.GetDataAsync(partitionKey, rowKey));
        }
Esempio n. 2
0
        public async Task <IClientAccount> RegisterAsync(IClientAccount clientAccount, string password)
        {
            var newEntity   = ClientAccountEntity.CreateNew(clientAccount, password);
            var indexEntity = AzureIndex.Create(IndexEmail, newEntity.Email, newEntity);

            await _emailIndices.InsertAsync(indexEntity);

            await _tradersTableStorage.InsertAsync(newEntity);

            return(newEntity);
        }
Esempio n. 3
0
        public Task ChangePassword(string clientId, string newPassword)
        {
            var partitionKey = ClientAccountEntity.GeneratePartitionKey();
            var rowKey       = ClientAccountEntity.GenerateRowKey(clientId);

            return(_tradersTableStorage.ReplaceAsync(partitionKey, rowKey, itm =>
            {
                itm.SetPassword(newPassword);
                return itm;
            }));
        }
Esempio n. 4
0
        public static ClientAccountEntity CreateNew(IClientAccount clientAccount, string password)
        {
            var result = new ClientAccountEntity
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey = Guid.NewGuid().ToString(),
                Email = clientAccount.Email.ToLower(),
                Phone = clientAccount.Phone,
                Registered = clientAccount.Registered
            };

            result.SetPassword(password);

            return result;
        }
Esempio n. 5
0
        public static ClientAccountEntity CreateNew(IClientAccount clientAccount, string password)
        {
            var result = new ClientAccountEntity
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey       = Guid.NewGuid().ToString(),
                Email        = clientAccount.Email.ToLower(),
                Phone        = clientAccount.Phone,
                Registered   = clientAccount.Registered
            };

            result.SetPassword(password);

            return(result);
        }