Exemplo n.º 1
0
        public async Task AddAssetAsync(AssetSettings assetSettings, string userId)
        {
            AssetSettings existingAssetSettings = await GetAssetAsync(assetSettings.Asset, assetSettings.Exchange);

            if (existingAssetSettings != null)
            {
                throw new EntityAlreadyExistsException();
            }

            await _assetSettingsRepository.InsertAsync(assetSettings);

            _assetsCache.Set(assetSettings);

            _log.InfoWithDetails("Asset settings added", new { assetSettings, userId });
        }
Exemplo n.º 2
0
        public async Task AddAsync(Domain.AssetSettings assetSettings)
        {
            Domain.AssetSettings existingAssetSettings = (await GetAllAsync())
                                                         .SingleOrDefault(o => o.AssetId == assetSettings.AssetId);

            if (existingAssetSettings != null)
            {
                throw new EntityAlreadyExistsException();
            }

            await _assetSettingsRepository.InsertAsync(assetSettings);

            _cache.Set(assetSettings);

            _log.InfoWithDetails("Asset settings were added", assetSettings);
        }