示例#1
0
        public async Task <NoteListDTO> UpdateNoteListAsync(string id, UpdateNoteListDTO dto)
        {
            var item = await _repository.GetItemAsync(id);

            if (item == null)
            {
                throw new NotFoundException("Note list not found.");
            }

            _mapper.Map(dto, item);

            var updatedItem = await _repository.UpdateItemAsync(id, item);

            return(_mapper.Map <NoteListDTO>(updatedItem));
        }
        public async Task <ActionResult <NoteListDTO> > PutAsync(string id, [FromBody] UpdateNoteListDTO dto)
        {
            var note = await _noteService.UpdateNoteListAsync(id, dto);

            return(Ok(note));
        }