public async Task <IActionResult> OnPostFilterSortAsync() { Guests = await _guestService.GetGuestsByName(FilterCriteria); switch (SortCriteria) { case "Number": Guests = (from guest in Guests orderby guest.GuestNo select guest).ToList(); break; case "Name": Guests = (from guest in Guests orderby guest.Name select guest).ToList(); break; case "Address": Guests = (from guest in Guests orderby guest.Address select guest).ToList(); break; } if (!SortAscending) { Guests.Reverse(); } return(Page()); }