private void RemoveContentFromList()
        {
            Console.WriteLine("Which item would you like to remove?");
            List <MenuContent> contentList = _menuRepo.GetContents();
            int count = 0;

            foreach (var content in contentList)
            {
                count++;
                Console.WriteLine($"{count}. {content.MenuNumber}");
            }
            int targetContentID = int.Parse(Console.ReadLine());
            int correctIndex    = targetContentID - 1;

            if (correctIndex >= 0 && correctIndex < contentList.Count)
            {
                MenuContent desiredContent = contentList[correctIndex];
                if (_menuRepo.DeleteExistingContent(desiredContent))
                {
                    Console.WriteLine($"{ desiredContent.MenuNumber} successfully removed!");
                }
                else
                {
                    Console.WriteLine("Sorry, can't perform");
                }
            }
            else
            {
                Console.WriteLine("Invalid Selection");
            }
            Console.WriteLine("Press any key to continue");
            Console.ReadLine();
        }
Example #2
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //AAA
            MenuContent foundContent = _repo.GetContentItemByMenuNumber("1");
            bool        removeResult = _repo.DeleteExistingContent(foundContent);

            Assert.IsTrue(removeResult);
        }