public async Task <double> GetLimitByAssetAsync(string assetId)
        {
            var record = await _tableStorage.GetDataAsync(WithdrawLimitRecord.GeneratePartitionKey(), WithdrawLimitRecord.GenerateRowKey(assetId));

            if (record == null || record.LimitAmount <= 0)
            {
                return(_defaultLimit);
            }

            return(record.LimitAmount);
        }
        public static WithdrawLimitRecord Create(string assetId, double limitAmount)
        {
            var limitRecord = new WithdrawLimitRecord()
            {
                PartitionKey = GeneratePartitionKey(),
                RowKey       = GenerateRowKey(assetId),
                AssetId      = assetId,
                LimitAmount  = limitAmount,
                Timestamp    = DateTime.UtcNow
            };

            return(limitRecord);
        }
        public async Task <bool> AddAsync(IWithdrawLimit item)
        {
            try
            {
                var record = WithdrawLimitRecord.Create(item.AssetId, item.LimitAmount);
                await _tableStorage.InsertOrReplaceAsync(record);

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public async Task <IEnumerable <IWithdrawLimit> > GetDataAsync()
        {
            var records = await _tableStorage.GetDataAsync(WithdrawLimitRecord.GeneratePartitionKey());

            return(records ?? new List <WithdrawLimitRecord>());
        }
 public async Task <bool> DeleteAsync(string assetId)
 {
     return(await _tableStorage.DeleteIfExistAsync(WithdrawLimitRecord.GeneratePartitionKey(), WithdrawLimitRecord.GenerateRowKey(assetId)));
 }