Beispiel #1
0
        public async Task DeleteAsync(string merchantId)
        {
            VolatilitySettingsEntity deletedEntity = await _storage.DeleteAsync(
                VolatilitySettingsEntity.ByMerchant.GeneratePartitionKey(merchantId),
                VolatilitySettingsEntity.ByMerchant.GenerateRowKey(merchantId));

            if (deletedEntity == null)
            {
                throw new KeyNotFoundException();
            }
        }
Beispiel #2
0
        public async Task <IVolatilitySettings> GetAsync(string merchantId)
        {
            VolatilitySettingsEntity entity = await _storage.GetDataAsync(
                VolatilitySettingsEntity.ByMerchant.GeneratePartitionKey(merchantId),
                VolatilitySettingsEntity.ByMerchant.GenerateRowKey(merchantId));

            if (entity == null)
            {
                throw new KeyNotFoundException();
            }

            return(Mapper.Map <VolatilitySettings>(entity));
        }
Beispiel #3
0
        public async Task <IVolatilitySettings> UpdateAsync(IVolatilitySettings src)
        {
            VolatilitySettingsEntity updatedEntity = await _storage.MergeAsync(
                VolatilitySettingsEntity.ByMerchant.GeneratePartitionKey(src.MerchantId),
                VolatilitySettingsEntity.ByMerchant.GenerateRowKey(src.MerchantId), entity =>
            {
                if (!string.IsNullOrEmpty(src.ZeroCoverageAssetPairs))
                {
                    entity.ZeroCoverageAssetPairs = src.ZeroCoverageAssetPairs;
                }

                entity.IsDeltaSpreadFixed = src.IsDeltaSpreadFixed;

                return(entity);
            });

            if (updatedEntity == null)
            {
                throw new KeyNotFoundException();
            }

            return(Mapper.Map <VolatilitySettings>(updatedEntity));
        }