public SelectList SelectListPaymentMethods(int? selectedId) { var list = ListPaymentMethods(true); if (selectedId.HasValue) return new SelectList(list, "MethodId", "Name", selectedId.Value); var paymentMethod = new PaymentMethod { MethodId = 0, Name = "Please select", Visible = true }; list.Add(paymentMethod); return new SelectList(list, "MethodId", "Name"); }
public bool EditPaymentMethod(PaymentMethod paymentMethod) { try { _paymentMethodRepository.EditPaymentMethod(paymentMethod); return true; } catch (Exception ex) { _validationDictionary.AddError("_FORM", "Payment is not edited. " + ex.Message); return false; } }
public ActionResult Edit(PaymentMethod paymentMethod) { if (_paymentMethodService.EditPaymentMethod(paymentMethod)) return RedirectToAction("Index"); return View(paymentMethod); }
public ActionResult Create(PaymentMethod paymentMethod) { if (_paymentMethodService.Create(paymentMethod)) return RedirectToAction("Index"); return View(paymentMethod); }