public ActionResult Edit(int id, int customerId) { var model = new EditCreditCardViewModel(); prepareEditModel(model, id, customerId); model.CreditCard = CustomerService.FindCreditCardModel(id, model.CurrentCompany, customerId); model.ParentId = customerId; model.LGS = CustomerService.LockCreditCard(model.CreditCard); return(View(model)); }
void prepareEditModel(EditCreditCardViewModel model, int id, int customerId) { var customer = CustomerService.FindCustomerModel(customerId, CurrentCompany); string title = EvolutionResources.bnrAddEditCreditCard + (customer == null ? "" : " - " + customer.Name); if (id <= 0) { title += " - " + EvolutionResources.lblNewContact; } PrepareViewModel(model, title, customerId, MakeMenuOptionFlags(customerId, 0)); model.CardProviderList = LookupService.FindCreditCardProviders(); }
public CreditCardInformation AskForCreditCard() { CreditCardInformation result = null; SafeInvoke(() => { var vm = new EditCreditCardViewModel { InEditMode = false }; var dialog = new AskForCreditCardToContinueMetroWindow { Owner = (Window)ShellHandle, DataContext = vm }; ShellHandle = dialog; dialog.ShowDialog(); ShellHandle = dialog.Owner; if (dialog.ViewModel.IsValidCreditCard) { result = dialog.ViewModel.CreditCardInformation; } }); return result; }
public ActionResult Save(EditCreditCardViewModel model, string command) { if (command.ToLower() == "save") { var modelError = CustomerService.InsertOrUpdateCreditCard(model.CreditCard, model.LGS); if (modelError.IsError) { prepareEditModel(model, model.CurrentCompany.Id, model.CreditCard.CustomerId); model.SetErrorOnField(ErrorIcon.Error, modelError.Message, "CreditCard_" + modelError.FieldName); return(View("Edit", model)); } else { return(RedirectToAction("CreditCards", new { id = model.ParentId })); } } else { return(RedirectToAction("CreditCards", new { id = model.ParentId })); } }
public bool EditCreditCard(CreditCardInformation creditCardInformation) { var vm = new EditCreditCardViewModel { CreditCardInformation = creditCardInformation }; var dialog = new EditCreditCardMetroWindow { Owner = (Window)ShellHandle, DataContext = vm, }; ShellHandle = dialog; var result = dialog.ShowDialog(); ShellHandle = dialog.Owner; return result.HasValue && result.Value; }