Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        public ActionResult Configure(int? id, string module)
        {
            var model = new PaymentConfigureViewModel();
            SetupConfigureViewModel(model, module);

            return View(model);
        }
Exemplo n.º 4
0
 private void SetupConfigureViewModel(PaymentConfigureViewModel model, string module)
 {
     model.ModuleInfo = _paymentModuleManager.GetModuleInfo(module);
     if (model.ModuleInfo == null)
     {
         throw new HttpException(404, "Not found");
     }
 }
Exemplo n.º 5
0
        public ActionResult Configure(int?id, string module)
        {
            var model = new PaymentConfigureViewModel();

            SetupConfigureViewModel(model, module);

            return(View(model));
        }
Exemplo n.º 6
0
 private void SetupConfigureViewModel(PaymentConfigureViewModel model, string module)
 {
     model.ModuleInfo = _paymentModuleManager.GetModuleInfo(module);
     if (model.ModuleInfo == null)
     {
         throw new HttpException(404, "Not found");
     }
 }