Esempio n. 1
0
        public ActionResult Index()
        {
            var viewModel = new MockDepositIndexViewModel
            {
                Assets = _assetsDictionary.GetAll()
            };

            return(View(viewModel));
        }
        public async Task <ActionResult> Index()
        {
            var id        = this.GetTraderId();
            var viewModel = new MarketPlaceIndexViewModel
            {
                Assets           = _assetsDictionary.GetAll().ToDictionary(itm => itm.Id),
                Trader           = await _clientAccountsRepository.GetByIdAsync(id),
                CurrencyBalances = await _srvBalanceAccess.GetCurrencyBalances(id)
            };

            return(View(viewModel));
        }
Esempio n. 3
0
        public async Task <CurrencyBalance[]> GetCurrencyBalances(string traderId)
        {
            var balances = (await _balanceRepository.GetAsync(traderId)).ToArray();

            var result = _assetsDictionary.GetAll().Select(value => CurrencyBalance.Create(value.Id, 0)).ToArray();

            foreach (var currencyBalance in result)
            {
                var balance = balances.FirstOrDefault(itm => itm.Currency == currencyBalance.Id);

                if (balance != null)
                {
                    currencyBalance.Value = balance.Amount;
                }
            }

            return(result);
        }