Esempio n. 1
0
        // GET
        public async Task <IActionResult> Index()
        {
            var profileDto = await _profileAppService.GetUserProfileAsync();

            var accountHolderDto = await _accountHolderAppService.GetAccountHolderDetail();


            var banks           = _bankRepository.GetAllList();
            var bankSelectItems = new List <SelectListItem>
            {
                new SelectListItem {
                    Value = "-1", Text = "Select Bank"
                }
            };

            foreach (var bank in banks)
            {
                bankSelectItems.Add(new SelectListItem {
                    Value = bank.BankKey.ToString(), Text = bank.Name
                });
            }

            var viewModel = new ProfileViewModel
            {
                Email         = profileDto.Email,
                FirstName     = profileDto.FirstName,
                LastName      = profileDto.LastName,
                PhoneNumber   = profileDto.PhoneNumber,
                Bank          = "-1",
                Banks         = bankSelectItems,
                AccountNumber = accountHolderDto.BankAccountNumber,
                AccountName   = accountHolderDto.BankAccountName
            };

            if (accountHolderDto.Bank != null)
            {
                Logger.Info("account holder bank: " + accountHolderDto.Bank.BankKey);
                viewModel.Bank = accountHolderDto.Bank.BankKey.ToString();
            }

            return(View(viewModel));
        }