public async Task AddAssetToWalletAsync([FromBody] AssetSettingsModel assetSettingsModel) { await _walletSettingsService.AddAssetToWalletAsync(assetSettingsModel.WalletId, assetSettingsModel.Id); await _realisedPnLService.InitializeAsync(assetSettingsModel.WalletId, assetSettingsModel.Id, assetSettingsModel.Amount); }
public async Task AddAsync([FromBody] AssetSettingsModel settingsModel) { try { var asset = Mapper.Map <AssetSettings>(settingsModel); await _assetSettingsService.AddAsync(asset); } catch (EntityAlreadyExistsException) { throw new ValidationApiException(HttpStatusCode.Conflict, "Asset settings already exist."); } }
public async Task UpdateAsync([FromBody] AssetSettingsModel model, string userId) { try { var assetSettings = Mapper.Map <AssetSettings>(model); await _instrumentService.UpdateAssetAsync(assetSettings, userId); } catch (EntityNotFoundException) { throw new ValidationApiException(HttpStatusCode.NotFound, "The asset settings does not exist"); } }
public async Task AddAsync([FromBody] AssetSettingsModel model, string userId) { try { var assetSettings = Mapper.Map <AssetSettings>(model); await _instrumentService.AddAssetAsync(assetSettings, userId); } catch (EntityAlreadyExistsException) { throw new ValidationApiException(HttpStatusCode.Conflict, "The asset settings already exists"); } }
public async Task UpdateAsync([FromBody] AssetSettingsModel settingsModel) { try { var asset = Mapper.Map <AssetSettings>(settingsModel); await _assetSettingsService.UpdateAsync(asset); } catch (InvalidOperationException exception) { throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message); } catch (EntityNotFoundException) { throw new ValidationApiException(HttpStatusCode.NotFound, "Asset settings do not exist."); } }