//Delete a menu item private void DeleteMenuItem() { Console.Clear(); ViewCurrentMenuItems(); Console.WriteLine("Please enter the meal name or number you wish to delete"); string input = Console.ReadLine(); int singleNum; bool isItNumber = Int32.TryParse(input, out singleNum); if (isItNumber == true) { Cafe item = _menuRepo.GetItemsByNumber(singleNum); if (item != null) { string writeIngredients = null; foreach (string ingredients in item.Ingredients) { writeIngredients = ingredients; } Console.WriteLine($"Meal Number: {item.MealNumber}\n" + $"Meal Name: {item.MealName}\n" + $"Description: {item.Description}\n" + $"Ingredients: {writeIngredients}\n" + $"Price: {item.Price}\n" + $"\n" + $"Are you sure you wish to delete this item? Y or N"); string response = Console.ReadLine().ToLower(); if (response == "y") { _menuRepo.RemoveItemByNumber(item.MealNumber); } else { Console.WriteLine("You have selected not to delete this item\n" + "Press any key to continue"); Console.ReadKey(); Menu(); } } else { Console.WriteLine("There was no meal attributed to that number. \n" + "Press any key to continue"); Console.ReadKey(); Menu(); } } else { Cafe item = _menuRepo.GetItemsByName(input); if (item != null) { Console.WriteLine($"Meal Number: {item.MealNumber}\n" + $"Meal Name: {item.MealName}\n" + $"Description: {item.Description}\n" + $"Ingredients: {item.Ingredients}\n" + $"Price: {item.Price}\n" + $"\n" + $"Are you sure you wish to delete this item? Y or N"); string response = Console.ReadLine().ToLower(); if (response == "y") { _menuRepo.RemoveItemByName(item.MealName); } else { Console.WriteLine("You have selected not to delete this item\n" + "Press any key to continue"); Console.ReadKey(); Menu(); } } else { Console.WriteLine("There was no meal attributed to that name. \n" + "Press any key to continue"); Console.ReadKey(); Menu(); } } }