/// <summary> /// Add/Edit Credit card of current customer or current organization /// </summary> /// <param name="currentPage">Current credit card page</param> /// <param name="creditCardId">Credit card id</param> /// <returns></returns> private ActionResult CreditCardEditView(CreditCardPage currentPage, string creditCardId) { var viewModel = new CreditCardViewModel(currentPage) { CreditCard = new CreditCardModel { CreditCardId = creditCardId }, CurrentContent = currentPage, IsB2B = currentPage.B2B }; if (currentPage.B2B) { viewModel.Organizations = viewModel.GetAllOrganizationAndSub(_organizationService.GetCurrentFoundationOrganization()); } if (_creditCardService.IsValid(viewModel.CreditCard.CreditCardId, out var errorMessage)) { _creditCardService.LoadCreditCard(viewModel.CreditCard); } else { viewModel.ErrorMessage = errorMessage; } ViewData["IsReadOnly"] = false; return(View("EditForm", viewModel)); }
public ActionResult Save(CreditCardViewModel viewModel) { _creditCardService.Save(viewModel.CreditCard); return(RedirectToAction("Index")); }