Exemple #1
0
        public async Task <IActionResult> UpdateNote(KB_note updatedNote)
        {
            if (ModelState.IsValid)
            {
                await _db.UpdateNote(updatedNote);

                return(RedirectToAction("Index", "Panel"));
            }
            return(View(updatedNote));
        }
Exemple #2
0
        public async Task <IActionResult> CreateNote(KB_note newNote)
        {
            if (ModelState.IsValid)
            {
                await _db.CreateNote(newNote);

                return(RedirectToAction("Index", "Panel"));
            }
            return(View(newNote));
        }
 // Update
 public async Task UpdateNote(KB_note newNote)
 {
     await NoteCollection.ReplaceOneAsync(new BsonDocument("_id", new ObjectId(newNote.Id)), newNote);
 }
 // Create
 public async Task CreateNote(KB_note note)
 {
     await NoteCollection.InsertOneAsync(note);
 }