Esempio n. 1
0
        public void UpdateWord(Word word)
        {
            var uow = new VocabularyUow(new VocabularyDbContext());
            IVocabularyService vocabularyService = new VocabularyService(uow);

            try
            {
                vocabularyService.UpdateWord(word);
                Clients.PublishUpdated("Успех!");
            }
            catch(Exception)
            {
                Clients.PublishUpdated("Ошибка");

            }
        }
Esempio n. 2
0
        /// <summary>
        /// Updates the word.
        /// </summary>
        /// <param name="word">The word.</param>
        public void UpdateWord(Word word)
        {
            if(word.IsNew())
            {
                vocabularyUow.Words.InsertOrUpdate(word, true);
            }
            else
            {
                var dbWord = vocabularyUow.Words.GetById(word.Id);
                vocabularyUow.Words.InsertOrUpdate(dbWord, true);
                dbWord.Key = word.Key;
                dbWord.Theme = word.Theme;
                dbWord.Description = word.Description;
            }

            vocabularyUow.Commit();
        }
Esempio n. 3
0
 /// <summary>
 /// Deletes the word.
 /// </summary>
 /// <param name="word">The word.</param>
 public void DeleteWord(Word word)
 {
     vocabularyUow.Words.Delete(word);
     vocabularyUow.Commit();
 }