public async Task <ActionResult> EditAssetDialog(string id) { var viewModel = new EditAssetDialogViewModel { Caption = Phrases.EditAsset, Asset = string.IsNullOrEmpty(id) ? Asset.CreateDefault() : await _assetsRepository.GetAssetAsync(id) }; return(View(viewModel)); }
public async Task GenerateCashInAsync(string clientId, string assetId, double amount) { var walletData = await _walletCredentialsRepository.GetAsync(clientId); var asset = await _assetsRepository.GetAssetAsync(assetId); var transactionId = Guid.NewGuid().ToString("N"); var pendingRecordId = await _balancePendingRepository.CreateAsync(clientId, assetId, amount); var contextData = new CashInContextData(clientId, pendingRecordId); await _bitCoinTransactionsRepository.CreateAsync(transactionId, BitCoinCommands.CashIn, contextData); var request = await _bitCoinCommandProducer.ProduceCashInCommand(transactionId, walletData.MultiSig, amount, asset.BlockChainId); await _bitCoinTransactionsRepository.UpdateRequestAsync(transactionId, request); }
public static async Task <IAsset> FindAssetByBlockchainAssetIdAsync(this IAssetsRepository assetsRepository, string blockchainAssetId) { if (blockchainAssetId == null) { return(await assetsRepository.GetAssetAsync(LykkeConstants.BitcoinAssetId)); } var assets = await assetsRepository.GetAssetsAsync(); return(assets.FirstOrDefault(itm => itm.BlockChainAssetId == blockchainAssetId || itm.Id == blockchainAssetId)); }
public async Task <EmailMessage> GenerateCashInMsg(CashInData cashInData) { if (cashInData.AssetId == null) { throw new ArgumentNullException("AssetId"); } var asset = await _assetsRepository.GetAssetAsync(cashInData.AssetId); var templateVm = new CashInTemplate() { Multisig = cashInData.Multisig, Year = DateTime.UtcNow.Year.ToString(), AssetName = asset.Id == LykkeConstants.LykkeAssetId ? EmailResources.LykkeCoins_name : asset.Name }; return(new EmailMessage() { Body = await _templateGenerator.GenerateAsync("CashInTemplate", templateVm, TemplateType.Email), Subject = string.Format(EmailResources.CashIn_Subject, templateVm.AssetName), IsHtml = true }); }