Beispiel #1
0
        public async Task <IActionResult> Put([FromRoute] int id, [FromBody] Note note)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            // var mongodbService = new KeepService("NotesDatabase", "Notes", "mongodb://127.0.0.1:27017");
            await _context.UpdateNote(id, note);

            return(Ok(note));
        }
 public IActionResult Put(int id, [FromBody] Note note)
 {
     try
     {
         return(Ok(keepService.UpdateNote(id, note)));
     }
     catch (Exception e)
     {
         return(NotFound(e.Message));
     }
 }