public IActionResult Edit(int id, WalletEditViewModel model) { var wallet = _transactionData.GetWallet(id); if (ModelState.IsValid) { wallet.Currency = _transactionData.GetCurrencyBasedOnName(model.Currency); wallet.Name = model.Name; wallet.UserId = _currentUserId; _transactionData.Commit(); return(RedirectToAction("Details", new { id = wallet.Id })); } return(View(wallet)); }
WalletEditViewModel BuildWalletEditViewModel(Customer customer, WalletPaymentType model = null) { var walletEditViewModel = new WalletEditViewModel( dateExpirationMonthOptions: BuildMonthOptionsSelectList(), dateExpirationYearOptions: BuildYearOptionsSelectList(), billingAddressOptions: BuildBillingAddressesSelectList(customer.CustomerID)); if (model != null) { walletEditViewModel.BillingAddressId = model.BillingAddressId; walletEditViewModel.CardImage = model.CardImage; walletEditViewModel.CardNumber = model.CardNumber; walletEditViewModel.CardSecurityCode = model.CardSecurityCode; walletEditViewModel.CardType = model.CardType; walletEditViewModel.ExpirationMonth = model.ExpirationMonth; walletEditViewModel.ExpirationYear = model.ExpirationYear; walletEditViewModel.MakePrimary = model.MakePrimary; walletEditViewModel.PaymentProfileId = model.PaymentProfileId; } return(walletEditViewModel); }