public static void AddItemToKart(KartItem kartItem, Dictionary <string, MarkdownItem> markdownItem) { string name = UserInput.GetInput("Enter name:"); //Ensures that the name is valid. Case sensitive while (!StoreItemController.IsItemNameValid(name)) { UserInput.Message("Item name is not valid. Names are case sensitive.", false); name = UserInput.GetInput("Enter name:"); } double amount = 0; while (!double.TryParse(UserInput.GetInput("Amount:"), out amount)) { UserInput.Message("not a valid amount:", false); } kartItem.AddItemToKart(name, amount, markdownItem); }
public static void AddItem(Dictionary <string, MarkdownItem> markdownList) { string name = StoreItemController.GetItem(markdownList); double amount = 0; while (!double.TryParse(UserInput.GetInput("Amount: "), out amount)) { UserInput.Message("Not a valid amount!"); } ///add do while here double price = 0; while (!double.TryParse(UserInput.GetInput("New price: "), out price)) { UserInput.Message("Not a valid price!"); } markdownList.Add(name, new MarkdownItem(price, amount)); }