public async Task OnGetAsync() { var todoItems = await _todoClient.GetItemsAsync(); CompleteTodoItems = todoItems.Where(x => x.IsComplete).ToList(); IncompleteTodoItems = todoItems.Except(CompleteTodoItems).ToList(); }
/// <summary> /// 调用HttpClient Get /// </summary> /// <returns></returns> public async Task <IActionResult> Index() { var todoItems = await _todoClient.GetItemsAsync(); IndexModel indexModel = new IndexModel(); var completeTodoItems = todoItems.Where(x => x.IsComplete).ToList(); var incompleteTodoItems = todoItems.Except(completeTodoItems).ToList(); indexModel.CompleteTodoItems = completeTodoItems; indexModel.IncompleteTodoItems = incompleteTodoItems; return(View(indexModel)); }