Esempio n. 1
0
 private void updateWords()
 {
     using (var db = new WordsContext())
     {
         db.Words.UpdateRange(_words);
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 private void saveWords()
 {
     using (var db = new WordsContext())
     {
         db.Words.AddRange(_words);
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 private void loadWords()
 {
     using (var db = new WordsContext())
     {
         _words = new List <Word>(db.Words.ToList());
         _names = new List <Word>(db.Words.Where(n => n is Name).Include(w => ((Name)w).OtherForms)
                                  .Include(w => ((Name)w).Article).ToList());
         _articles = new List <Word>(db.Words.Where(n => n is Article).ToList());
         _verbs    = new List <Word>(db.Words.Where(n => n is Verb).ToList());
         sortWordsAlphabetically(_names);
     }
 }
Esempio n. 4
0
        public WordDictionary()
        {
            bool hasData = true;

            WordsToPresent = new ObservableCollection <Word>();

            using (var db = new WordsContext())
                hasData = db.Words.Count() > 0 ? true : false;

            if (!hasData)
            {
                mockArticles();
                mockWords();
            }

            loadWords();
        }