Exemple #1
0
        private static void TestCreators()
        {
            IEnumerable <ICreator> creators = new List <ICreator>();

            while (true)
            {
                Console.WriteLine("Press Enter to Add Creator; type 'exit' to quit.");

                var input = Console.ReadLine();

                Console.Clear();

                if (input.Equals("exit", StringComparison.OrdinalIgnoreCase))
                {
                    break;
                }

                string name = "John Cossu";

                if (DateTime.Now.Second % 2 == 0)
                {
                    name = "Christian Micklish";
                }

                ICreator newCreator = new Creator($"{name} _ {DateTime.Now}", "MyJson");

                newCreator = CreatorDao.Add(newCreator);

                creators = CreatorDao.Get();

                foreach (ICreator creator in creators)
                {
                    Console.WriteLine($"ID: {creator.Id} / Name: {creator.Name}");
                }

                Console.WriteLine(Environment.NewLine + Environment.NewLine);
            }
        }
Exemple #2
0
        /// <summary>
        /// Instansiates new Creator object and passes to DAO
        /// </summary>
        /// <param name="name">name of creator</param>
        /// <param name="json">additional info</param>
        /// <returns></returns>
        public ICreator AddCreator(string name, string json)
        {
            ICreator creator = new Creator(name, json);

            return(CreatorDao.Add(creator));
        }