public async void FetchData() { var service = new UserQuery(); var result = await service.GetAllUsers(); if (result.Data != null) { var items = result.Data.Users.OrderBy(m => m.LastName).ToList(); Users = new ObservableCollection <User>(items); } }
public ActionResult ShowUsers() { UserQuery userQuery = new UserQuery(); List <User> listOfAllUsers = userQuery.GetAllUsers(); if (listOfAllUsers.Count > 0) { ViewData["AllUsers"] = listOfAllUsers; return(View()); } else { return(RedirectToAction("Index")); } }