Пример #1
0
        public static void AddSampleWords(MongoCollection<DictionaryItem> dictionaryItems)
        {
            var firstItem = new DictionaryItem { Word = "1", Translation = "One" };
            var secondItem = new DictionaryItem { Word = "2", Translation = "Two" };
            var thirdItem = new DictionaryItem { Word = "3", Translation = "Three" };
            var fourthItem = new DictionaryItem { Word = "4", Translation = "Four" };
            var fifthItem = new DictionaryItem { Word = "5", Translation = "Five" };

            dictionaryItems.Insert(firstItem);
            dictionaryItems.Insert(secondItem);
            dictionaryItems.Insert(thirdItem);
            dictionaryItems.Insert(fourthItem);
            dictionaryItems.Insert(fifthItem);
        }
Пример #2
0
        public static void AddItem(MongoCollection<DictionaryItem> dictionaryItems)
        {
            Console.WriteLine("Enter word: ");
            string word = Console.ReadLine();
            Console.WriteLine("Enter translation: ");
            string translation = Console.ReadLine();

            var newDictionaryItem = new DictionaryItem { Word = word, Translation = translation };
            dictionaryItems.Insert(newDictionaryItem);
            Console.WriteLine("Element added");
        }