var noteService = MerchelloContext.Current.Services.NoteService;
var note = noteService.CreateNote(invoice.Key, EntityType.Invoice, "My note text");
note.Author = "System Note";
note.CreateDate = DateTime.UtcNow;
note.InternalOnly = false;
noteService.Save(note);
But then I need to update the invoice notes collection - or do I - this part just feels weird.
// TODO: must be a better way
var allNotes = new List<INote>(); // new notes list
if (invoice.Notes != null)
allNotes.AddRange(invoice.Notes); // add existing notes to new list
allNotes.Add(note); // add new note to list
invoice.Notes = allNotes; // pass new list to invoice
MerchelloContext.Current.Services.InvoiceService.Save(invoice); // save invoice
Hey Kevin - yes that part is a bit weird and is a result of the notes going through a couple rounds of refactoring .
I think we need to provide some extension methods for both Invoice and Customer to make things more fluid.
One thing though ... you should not need to save the note with the note service:
var noteService = MerchelloContext.Current.Services.NoteService;
var note = noteService.CreateNote(invoice.Key, EntityType.Invoice, "My note text");
note.Author = "System Note";
note.CreateDate = DateTime.UtcNow;
note.InternalOnly = false;
noteService.Save(note); // <- should not need this line
Add additional notes to existing invoice
Hi what is the correct way to do this.
I create my note and save it:
But then I need to update the invoice notes collection - or do I - this part just feels weird.
Thanks
Hey Kevin - yes that part is a bit weird and is a result of the notes going through a couple rounds of refactoring .
I think we need to provide some extension methods for both Invoice and Customer to make things more fluid.
One thing though ... you should not need to save the note with the note service:
is working on a reply...