public MerchantTotalAssetsDTO GetMerchantTotalAssets(Guid accountId) { var account = new MerchantAccountDAC().GetById(accountId); var walletList = new MerchantWalletDAC().GetByAccountId(accountId); decimal totalPrice = 0m; if (walletList.Count > 0) { var cryptoList = new CryptocurrencyDAC().GetAllActived(); if (account.POSId.HasValue) { var pos = new POSDAC().GetById(account.POSId.Value); if (!pos.IsWhiteLabel) { cryptoList.RemoveAll(t => t.IsWhiteLabel == 1); } } var marketPriceList = new MarketPriceComponent().GetMarketPrice(account.FiatCurrency); totalPrice = walletList.Sum(e => { var coin = cryptoList.FirstOrDefault(c => c.Id == e.CryptoId); var marketPrice = marketPriceList.FirstOrDefault(m => m.CryptoName == coin?.Code); return((e.Balance + e.FrozenBalance) * (marketPrice?.Price ?? 0)); }); } return(new MerchantTotalAssetsDTO { FiatCurrency = account.FiatCurrency, Amount = totalPrice.ToString("N", CultureInfo.InvariantCulture), IsAllowWithDrawal = account.IsAllowWithdrawal }); }