public void Update(Note noteToEdit, IEnumerable <Category> newCategories) { NoteWithCategories note = Read(noteToEdit.Id); note.Title = noteToEdit.Title; note.Message = noteToEdit.Message; note.Categories = newCategories; var query = Query.EQ("_id", ObjectId.Parse(noteToEdit.Id)); Notes.Update(query, MongoDB.Driver.Builders.Update.Replace(note)); }
public void Create(Note noteToAdd, IEnumerable <Category> newCategories) { NoteWithCategories note = NoteWithCategories.Convert(noteToAdd, newCategories); Notes.Insert(note); }