public static void DoAction(SantasNiceList registry)
        {
            Console.Clear();

            Console.WriteLine("Enter child name");
            Console.Write("> ");
            string childName = Console.ReadLine();
            Child  childId   = registry.AddChild(childName);
        }
Пример #2
0
        public static void DoAction(SantasToyBag bag, SantasNiceList book)
        {
            var kid = KidsMenu.Show(book);

            Console.WriteLine("Enter toy");
            Console.Write("> ");
            string toyName = Console.ReadLine();

            bag.Add(toyName, kid);
        }
        public static void DoAction(SantasToyBag bag, SantasNiceList book)
        {
            var kid = KidsMenu.Show(book);

            var toys = bag.GetToysForChild(kid).ToArray();

            foreach (var toy in toys)
            {
                Console.WriteLine($"{Array.IndexOf(toys, toy) + 1}. {toy.name}");
            }
            Console.Write("> ");
            var toyChoice = Console.ReadLine();
            var chosenToy = toys[int.Parse(toyChoice) - 1];

            bag.RevokeToy(chosenToy);
        }
Пример #4
0
        public static Child Show(SantasNiceList book)
        {
            Console.Clear();
            Console.WriteLine("Choose child");

            var children = book.GetChildren().ToArray();

            foreach (Child child in children)
            {
                Console.WriteLine($"{Array.IndexOf(children, child) + 1}. {child.name}");
            }

            Console.Write("> ");
            string childName = Console.ReadLine();

            return(book.GetChild(children[int.Parse(childName) - 1].name));
        }
 public ChildRegisterShould()
 {
     _register = new SantasNiceList();
 }
 public ToyRegisterShould()
 {
     _register = new SantasToyBag();
     _book     = new SantasNiceList();
 }