/// <summary> /// Display and handle user inputs for viewing a users wishlist of /// castles. This method simply displays the wishlist and any button /// pressed can exit the wishlist back to the account page. /// </summary> public void ViewWishlist() { var castleList = OnFetchUserWishlistEvent(); if (castleList.Count < 1) { ConsoleDisplay.ErrorNoCastlesInWishlist(); } else { ConsoleDisplay.FormatAndDisplayCastles("Wishlist View", castleList); ConsoleDisplay.WaitOnWishlistView(); } }
/// <summary> /// While within the Castle Display View bring up a menu that asks if /// you would like to add a specific castle to the wishlist. By inputing /// the castles name into the console the user can add that castle to their /// wishlist. /// </summary> /// <param name="castlesInfo">The list of castles to display to the user.</param> public void WishlistAdditionCastleView(Dictionary <string, Dictionary <string, List <string> > > castlesInfo) { bool bExit = false; string userInput, castleName; int answer; while (!bExit) { ConsoleDisplay.FormatAndDisplayCastles("Castle List View", castlesInfo); do { ConsoleDisplay.DisplayAddToWishlist(); userInput = Console.ReadLine(); answer = ConsoleUtil.TryUserInputConvert(userInput); } while (answer < 1 || answer > 2); switch (answer) { case 1: // Add to wishlist ConsoleDisplay.DisplayEnterToWishlist(); castleName = Console.ReadLine(); if (!OnSaveToWishlistEvent(castleName)) { ConsoleDisplay.ErrorCastleNotFound(castleName); } else { ConsoleDisplay.DisplayAddedToWishlist(castleName); } break; case 2: // Exit back to searching bExit = true; break; } } }