public async Task UpdateAssetAsync(AssetSettings assetSettings, string userId) { AssetSettings existingAssetSettings = await GetAssetAsync(assetSettings.Asset, assetSettings.Exchange); if (existingAssetSettings == null) { throw new EntityNotFoundException(); } await _assetSettingsRepository.UpdateAsync(assetSettings); _assetsCache.Set(assetSettings); _log.InfoWithDetails("Asset settings updated", new { assetSettings, userId }); }
public async Task UpdateAsync(Domain.AssetSettings assetSettings) { if (assetSettings.AssetId == AssetConsts.UsdAssetId) { throw new InvalidOperationException("Can not update non-editable asset."); } Domain.AssetSettings currentAssetSettings = await GetByIdAsync(assetSettings.AssetId); if (currentAssetSettings == null) { throw new EntityNotFoundException(); } currentAssetSettings.Update(assetSettings); await _assetSettingsRepository.UpdateAsync(currentAssetSettings); _cache.Set(currentAssetSettings); _log.InfoWithDetails("Asset settings were updated", assetSettings); }