public Payee?GetPayeeById(int?id) { if (id == null) { return(null); } return(Payees.FirstOrDefault(item => item.Id == id)); }
public Payee?GetPayeeByName(string?name) { if (name == null) { return(null); } return(Payees.FirstOrDefault(item => item.Name == name)); }
public void SavePayee(Payee payee) { using (DeferEvents()) { var existingPayee = Payees.FirstOrDefault(item => item.Id == payee.Id); if (existingPayee == null) { payee.Id = GenerateId(Payees, item => item.Id); } AddOrReplace(Payees, existingPayee, payee); MergePayees(); RaiseDatabaseChanged(); } }
public Payee?GetOrCreatePayeeByName(string?name) { if (name == null) { return(null); } var payee = Payees.FirstOrDefault(item => item.Name == name); if (payee == null) { payee = new Payee { Name = name }; SavePayee(payee); } return(payee); }