コード例 #1
0
 public VocabularySetTests()
 {
     _set = VocabularySet.Empty
            .WithName(_name)
            .Add(_alpha)
            .Add(_beta);
 }
コード例 #2
0
        //
        // GET: /Set/Edit/5

        public ActionResult Edit(int id)
        {
            VocabularySet vocabularyset =
                db.VocabularySets.Include("VocabularyItem").FirstOrDefault(m => m.Id == id);

            return(View(vocabularyset));
        }
コード例 #3
0
        //
        // GET: /Set/Details/5

        public ViewResult Details(int id)
        {
            VocabularySet vocabularyset =
                db.VocabularySets.Include(m => m.Words).FirstOrDefault(m => m.Id == id);

            return(View(vocabularyset));
        }
コード例 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            VocabularySet vocabularyset = db.VocabularySets.Find(id);

            db.VocabularySets.Remove(vocabularyset);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #5
0
            public WithVocabularySet()
            {
                var alpha = new VocabularyWord("alpha");
                var beta  = new VocabularyWord("beta");

                _set = VocabularySet.Empty
                       .Add(alpha)
                       .Add(beta);
            }
コード例 #6
0
 public ActionResult Edit(VocabularySet vocabularyset)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vocabularyset).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vocabularyset));
 }
コード例 #7
0
        public ActionResult Create(VocabularySet vocabularyset)
        {
            if (ModelState.IsValid)
            {
                db.VocabularySets.Add(vocabularyset);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vocabularyset));
        }
コード例 #8
0
        private void removeWord(VocabularyItem itemToRemove)
        {
            bool          wordIsRemoved = _removeWordFromVocabularyCallback(itemToRemove.id);
            VocabularySet setToRemove   = null;

            if (wordIsRemoved)
            {
                for (int i = 0; i < _vocabularyContents.Count; i++)
                {
                    VocabularySet set = _vocabularyContents[i];
                    if (set.section == itemToRemove.section)
                    {
                        set.words.Remove(itemToRemove);
                        if (set.words.Count == 0)
                        {
                            setToRemove = set;
                        }
                        break;
                    }
                }

                Control controlToRemove = null;
                foreach (Control control in _cellsContainer.Controls)
                {
                    if (control.Tag == itemToRemove)
                    {
                        controlToRemove = control;
                        break;
                    }
                }

                if (controlToRemove != null)
                {
                    _cellsContainer.Controls.Remove(controlToRemove);
                    controlToRemove.Dispose();

                    if (setToRemove != null)
                    {
                        checkRemoveTitle(setToRemove.section);
                        _vocabularyContents.Remove(setToRemove);
                    }

                    recolourCells();
                }
            }
        }
コード例 #9
0
 public Add()
 {
     _empty = VocabularySet.Empty
              .WithName(_name);
 }
コード例 #10
0
            public void GivenNull_ReturnsFalse()
            {
                VocabularySet other = null !;

                _set.Equals(other).Should().BeFalse();
            }
コード例 #11
0
        //
        // GET: /Set/Delete/5

        public ActionResult Delete(int id)
        {
            VocabularySet vocabularyset = db.VocabularySets.Find(id);

            return(View(vocabularyset));
        }
コード例 #12
0
 public static WordTutorApplication ApplicationStateWithVocabulary(VocabularySet words)
 => new WordTutorApplication(new FakeScreen())
 .WithVocabularySet(words);