コード例 #1
0
        public async Task <Note> PutNotes(Note notes)
        {
            _context.Note.Update(notes);
            await _context.SaveChangesAsync();

            return(notes);
        }
コード例 #2
0
        public async Task <IActionResult> AddNote([FromBody] Notes note)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            _notesContext.notes.Add(note);
            await _notesContext.SaveChangesAsync();

            return(CreatedAtAction("GetNotes", new { id = note.Id }, note));
        }