Пример #1
0
        public ActionResult MoveCashAssetToBank(int id)
        {
            var accountSetter = new CashAssetBankAccountSetInfo();

            accountSetter.AssetId = id;
            BankAccount account = assetService.GetCashAsset(id).Account;
            accountSetter.SelectedBankId = (account == null) ? 1 : account.Bank.Id;
            accountSetter.SelectedAccountNumber = (account == null) ? 1 : account.Number;

            var bankViewModels = new List<BankViewModel>();
            List<Bank> banks = bankService.GetAllBanks();
            banks.ForEach(b => bankViewModels.Add(mapper.GetBankViewModel(b)));
            accountSetter.Banks = new SelectList(bankViewModels, "Id", "Name", accountSetter.SelectedBankId);

            var accountViewModels = new List<BankAccountViewModel>();
            List<BankAccount> accounts = bankService.GetAllBankAccounts(accountSetter.SelectedBankId).ToList();
            accounts.ForEach(a => accountViewModels.Add(mapper.GetBankAccountViewModel(a)));
            accountSetter.Accounts = new SelectList(accountViewModels, "Number", "Number");

            return View("SetBankAccount", accountSetter);
        }
Пример #2
0
 public ActionResult MoveCashAssetToBank(CashAssetBankAccountSetInfo setInfo)
 {
     var cashAsset = assetService.GetCashAsset(setInfo.AssetId);
     BankAccount account = bankService.GetBankAccount(setInfo.SelectedBankId, setInfo.SelectedAccountNumber);
     assetService.SetBankAccount(setInfo.AssetId, account);
     return RedirectToAction("Index");
 }