예제 #1
0
        public async Task <double> GetUsdTotalAsync()
        {
            var partitionKey = Lkk2YTotalEntity.GeneratePartitionKey();
            var rowKey       = Lkk2YTotalEntity.GenerateRowKey();

            var entity = await _totalTableStorage.GetDataAsync(partitionKey, rowKey);

            return(entity?.Total ?? 0);
        }
예제 #2
0
        private async Task UpdateTotalAsync(double newTotal)
        {
            var partitionKey = Lkk2YTotalEntity.GeneratePartitionKey();
            var rowKey       = Lkk2YTotalEntity.GenerateRowKey();

            await _totalTableStorage.ReplaceAsync(partitionKey, rowKey, entity =>
            {
                entity.Total = newTotal;

                if (entity.Total > Lkk2YConstants.MaxIcoSize)
                {
                    entity.Total = Lkk2YConstants.MaxIcoSize;
                }

                return(entity);
            });
        }