private void NewOrderTax() { bool isValidTax = false; while (isValidTax == false) { //display options io.DisplayStates(manager.TaxList()); //get and verify string format for state abbreviation state = io.GetStringFromUser("Please enter State Abbreviation (OH format): "); if (state.Length != 2) { Console.WriteLine("State Abbreviation must be 2 characters long."); } else { state = state.ToUpper(); } //verify state is on list taxResponse = manager.Tax(state); if (taxResponse.Success) { isValidTax = true; } else { Console.WriteLine("The provided abbreviation does not match a state in our service region."); } } }
public string EditState() { string state = ""; bool isValid = false; //display options io.DisplayStates(manager.TaxList()); while (isValid == false) { //get state state = io.GetStringFromUser("Please enter new State Abbreviation or press Enter to skip: "); if (state == "") { return(state); } if (state.Length != 2) { Console.WriteLine("State Abbreviation must be 2 characters long."); } else { state = state.ToUpper(); } TaxStateResponse taxResponse = manager.Tax(state); if (taxResponse.Success) { isValid = true; } else { Console.WriteLine("The provided abbreviation does not match a state in our service region."); } } return(state); }