public async Task <ActionResult <TodoItemDto> > GetTodoItem(long id)
        {
            TodoItemDto item = await _todoItemsService.GetTodoItem(id);

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

            return(item); // ASP.NET Core serializa automáticamente el objeto a JSON y escribe el JSON en el cuerpo del mensaje de la respuesta HTTP 200
        }
Пример #2
0
        public async Task <IActionResult> GetTodoItem(long id)
        {
            var todoItemDto = await _itemsService.GetTodoItem(id);

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

            return(Ok(todoItemDto));
        }