public static void ProcessSortingByDate(ref bool sortOrder) { string sortStartMessage = "Would you like the results sorted oldest to latest or latest to oldest?"; List <string> sortOptions = new List <string>(2) { "Oldest to Latest.", "Latest to Oldest." }; UserResponseUtility.DisplayPossibleChoicesToUser(sortStartMessage, sortOptions); sortOrder = (UserRequestUtility.ProcessUserInputAgainstPossibleChoices(sortOptions)) switch { 1 => true, 2 => false, _ => throw new NotImplementedException(), }; }
public static void ProcessSortingByPrice(ref bool sortOrder) { string sortStartMessage = "You've chosen to sort orders by subtotal. Sort from lowest to highest subtotal, or highest to lowest subtotal?"; List <string> sortOptions = new List <string>(2) { "Lowest to highest.", "Highest to Lowest." }; UserResponseUtility.DisplayPossibleChoicesToUser(sortStartMessage, sortOptions); sortOrder = (UserRequestUtility.ProcessUserInputAgainstPossibleChoices(sortOptions)) switch { 1 => true, 2 => false, _ => throw new NotImplementedException(), }; }
/// <summary> /// This method handles each interaction the user has with the menu. /// </summary> public void QueryUserChoice() { selectedChoice = UserRequestUtility.ProcessUserInputAgainstPossibleChoices(PossibleOptions); Console.WriteLine(); }