public void AddEntry(InvoiceEntry entry) { if (Entries.Contains(entry)) { throw new Exception("Trying to add same entry twice"); } Entries.Add(entry); }
public void AddEntry(InvoiceEntry entry) { if (!Invoices.ContainsKey(entry.InvoiceId)) { AddInvoice(new Invoice { ClientId = Id, InvoiceId = entry.InvoiceId, Date = entry.Date }); } Invoices[entry.InvoiceId].AddEntry(entry); }