public ActionResult BasicInfo(int?id) { var model = new PaymentMethodEditorModel { AvailablePaymentProcessors = GetAvailablePaymentProcessors() }; if (id != null) { var method = _paymentMethodService.Find(id.Value); model.Id = method.Id; model.Name = method.Name; model.UserKey = method.UserKey; model.ProcessorName = method.ProcessorName; model.AdditionalFeeChargeMode = method.AdditionalFeeChargeMode; model.AdditionalFeeAmount = method.AdditionalFeeAmount; model.AdditionalFeePercent = method.AdditionalFeePercent; } return(View(model)); }
public ActionResult BasicInfo(PaymentMethodEditorModel model, string @return) { PaymentMethod method = null; if (model.Id > 0) { method = _paymentMethodService.Find(model.Id); model.UpdateTo(method); } else { method = new PaymentMethod(); model.UpdateTo(method); _paymentMethodService.Create(method); } if (model.Id > 0) { CurrentInstance.Database.SaveChanges(); } string redirectUrl = null; var processor = _processorProvider.FindByName(method.ProcessorName); var editor = processor as IHasCustomPaymentProcessorConfigEditor; if (editor != null || processor.ConfigType != null) { redirectUrl = Url.Action("Processor", RouteValues.From(Request.QueryString).Merge("id", method.Id)); } else { redirectUrl = Url.Action("Complete", RouteValues.From(Request.QueryString).Merge("id", method.Id)); } return(AjaxForm().RedirectTo(redirectUrl)); }