public Payee DeletePayee(Payee p) { Payees payees = myMoney.Payees; if (myMoney.GetUsedPayees().Contains(p)) { p = Rename(p); } else { payees.RemovePayee(p); } return(p); }
Payee Rename(Payee fromPayee, Payee renameToThisPayee) { RenamePayeeDialog dialog = RenamePayeeDialog.ShowDialogRenamePayee(this.Site, this.myMoney, fromPayee, renameToThisPayee); dialog.Owner = App.Current.MainWindow; if (dialog.ShowDialog() == true) { HashSet <Payee> used = myMoney.GetUsedPayees(); if (!used.Contains(fromPayee)) { // remove it now so that our list UI is updated... Payees payees = myMoney.Payees; payees.RemovePayee(fromPayee); } } return(dialog.Payee); }