예제 #1
0
        public async Task <NoteCategoryDTO> UpdateAsync(string id, UpdateNoteCategoryDTO dto)
        {
            var item = await _repository.GetItemAsync(id);

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

            _mapper.Map(dto, item);

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

            return(_mapper.Map <NoteCategoryDTO>(updatedItem));
        }
예제 #2
0
        public async Task <ActionResult <NoteCategoryDTO> > PutAsync(string id, [FromBody] UpdateNoteCategoryDTO dto)
        {
            var item = await _categoryService.UpdateAsync(id, dto);

            return(Ok(item));
        }