コード例 #1
0
        public ActionResult <TodoListReadDto> UpdateTodoList(string Id, TodoListUpdateDto todoListUpdateDto)
        {
            string userId = _todoListRepository.GetUserIdByTodoListId(Id);

            if (userId != User.Identity.Name)
            {
                return(Unauthorized());
            }

            var todoList = _todoListRepository.GetTodoListById(Id);

            if (todoList == null)
            {
                return(NotFound());
            }

            _mapper.Map(todoListUpdateDto, todoList);

            _todoListRepository.UpdateTodoList();

            return(NoContent());
        }