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()); }
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; } )); }