コード例 #1
0
        public async Task <IEnumerable <IWallet> > GetAsync(string traderId)
        {
            var partitionKey = WalletEntity.GeneratePartitionKey();
            var rowKey       = WalletEntity.GenerateRowKey(traderId);
            var entity       = await _tableStorage.GetDataAsync(partitionKey, rowKey);

            return(entity == null
                ? WalletEntity.EmptyList
                : entity.Get());
        }
コード例 #2
0
        public Task UpdateBalanceAsync(string traderId, string assetId, double balance)
        {
            var partitionKey = WalletEntity.GeneratePartitionKey();
            var rowKey       = WalletEntity.GenerateRowKey(assetId);

            return(_tableStorage.InsertOrModifyAsync(partitionKey, rowKey,

                                                     () =>
            {
                var newEntity = WalletEntity.Create(traderId);
                newEntity.UpdateBalance(assetId, balance);
                return newEntity;
            },

                                                     entity =>
            {
                entity.UpdateBalance(assetId, balance);
                return entity;
            }

                                                     ));
        }