Пример #1
0
        public void DeleteWord(string word)
        {
            if (word == null || word.Length < 2)
            {
                throw new Exception("Invalid word!");
            }

            int wordID = WordsRepository.FindWordID(word);

            WordsRepository.DeleteWord(wordID);
        }
Пример #2
0
        public void InsertCashedWords(string word, List <string> anagrams)
        {
            Repository.InsertIntoCashedWords(word);
            int?cachedWordId = Repository.GetCachedWordID(word);

            if (cachedWordId != null && anagrams != null && anagrams.Any())
            {
                List <int> anagramsID = new List <int>();
                int        anagramId;
                foreach (string anagram in anagrams)
                {
                    anagramId = WordsRepository.FindWordID(anagram);
                    anagramsID.Add(anagramId);
                }
                Repository.InsertIntoCashedAnagrams(cachedWordId.Value, anagramsID);
            }
        }