public async Task <IActionResult> Create() { IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs(); WalletVM emptyWallet = new WalletVM(); var pageVM = new UpsertWalletVM(emptyWallet, supportedBankVMs); return(View(pageVM)); }
public async Task <IActionResult> Create(WalletVM wallet) { try { WalletDTO createdWallet = await _walletService.CreateNewWallet(wallet.UniqueMasterCitizenNumber, wallet.PostalIndexNumber, wallet.SupportedBankId, wallet.FirstName, wallet.LastName); IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs(); var pageVM = new UpsertWalletVM(wallet, supportedBankVMs); ViewData["Success"] = $"Your password is {createdWallet.Password}"; return(View(pageVM)); } catch (Exception e) { IEnumerable <SupportedBankVM> supportedBankVMs = (await _supportedBankService.GetAllSupportedBanksAsync()).ToSupportedBankVMs(); var pageVM = new UpsertWalletVM(wallet, supportedBankVMs); ViewData["Error"] = e.Message; return(View(pageVM)); } }