コード例 #1
0
        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));
        }
コード例 #2
0
 public static NoteWithCategories Convert(Note note, IEnumerable<Category> categories)
 {
     return new NoteWithCategories
         {
             Id = note.Id,
             Title = note.Title,
             Message = note.Message,
             Added = note.Added,
             Categories = categories
         };
 }
コード例 #3
0
 public void Create(Note noteToAdd, IEnumerable<Category> newCategories)
 {
     NoteWithCategories note = NoteWithCategories.Convert(noteToAdd, newCategories);
     Notes.Insert(note);
 }