Ejemplo n.º 1
0
        private static void RunWithArguments(string[] args)
        {
            var command = $"{args[0]} {args[1]}";

            Console.WriteLine("connecting to Database");
            using (var db = new GlossaryDbContext())
            {
                Console.Clear();
                switch (command)
                {
                case "очистить словарь":
                    db.ClearGlossary();
                    break;

                case "создание словаря":
                    db.CreateGlossary();
                    Console.WriteLine("Done");
                    break;

                case "обновление словаря":
                    db.UpdateGlossary();
                    Console.WriteLine("Done");
                    break;

                default:
                    Console.WriteLine("Unknown command");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            if (args.Length == 2)
            {
                RunWithArguments(args);
            }

            if (args.Length == 0)
            {
                using (var db = new GlossaryDbContext())
                {
                    var glossary = db.Words.ToArray();
                    var line     = ReadFromConsole();

                    while (!string.IsNullOrEmpty(line))
                    {
                        Console.WriteLine();
                        AutoComplete(line, glossary);
                        line = ReadFromConsole();
                    }
                }
            }
        }