public ActionResult Configure([Bind(Prefix = "Form")] PaymentConfigureForm form, string module) { var model = new PaymentConfigureViewModel(); SetupConfigureViewModel(model, module); if (ModelState.IsValid) { var paymentModule = _paymentModuleManager.CreateModule(module); //// TODO: setup paymentModule from form values var method = new PaymentMethod { Name = paymentModule.Name }; _paymentModuleManager.SaveModuleToMethod(paymentModule, method); using (var transaction = _session.BeginTransaction()) { _session.Save(method); transaction.Commit(); } TempData["SuccessMessage"] = "Payment method has been activated"; return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Configure([Bind(Prefix = "Form")]PaymentConfigureForm form, string module) { var model = new PaymentConfigureViewModel(); SetupConfigureViewModel(model, module); if (ModelState.IsValid) { var paymentModule = _paymentModuleManager.CreateModule(module); //// TODO: setup paymentModule from form values var method = new PaymentMethod { Name = paymentModule.Name }; _paymentModuleManager.SaveModuleToMethod(paymentModule, method); using (var transaction = _session.BeginTransaction()) { _session.Save(method); transaction.Commit(); } TempData["SuccessMessage"] = "Payment method has been activated"; return RedirectToAction("Index"); } return View(model); }
public ActionResult Configure(int? id, string module) { var model = new PaymentConfigureViewModel(); SetupConfigureViewModel(model, module); return View(model); }
private void SetupConfigureViewModel(PaymentConfigureViewModel model, string module) { model.ModuleInfo = _paymentModuleManager.GetModuleInfo(module); if (model.ModuleInfo == null) { throw new HttpException(404, "Not found"); } }
public ActionResult Configure(int?id, string module) { var model = new PaymentConfigureViewModel(); SetupConfigureViewModel(model, module); return(View(model)); }