public async Task <ActionResult <List <TodoItem> > > GetTodoItem(Guid id) { var query = new GetTodoItemsByTodoListIdQuery(id); var response = await _mediator.Send(query); if (response == null) { return(NotFound()); } return(response); }
public Task <List <TodoItem> > Handle(GetTodoItemsByTodoListIdQuery request, CancellationToken cancellationToken) { var response = _context.TodoItems.Where(t => t.TodoListId == request.id).ToList(); var responseas = Task <List <TodoItem> > .FromResult(response); if (response == null) { return(null); } else { return(responseas); } }