Example #1
0
        public UpdateVerseCommand(VerseViewModel verse, DbList list = null)
        {
            if (verse == null)
                throw new ArgumentNullException("verse", "verse cannot be null.");

            _verse = verse;
            _list = list;
        }
Example #2
0
        public void UpdateVerse(VerseViewModel verse)
        {
            if (verse == null)
                throw new ArgumentNullException("verse", "verse cannot be null.");
            if (_verseUpdateStrategy == null)
                throw new InvalidOperationException("This verse list is not associated with a database.");

            _verseUpdateStrategy.Update(verse);

            Refresh();
        }
Example #3
0
        private void onNewVerse(object sender, EventArgs e)
        {
            var list = SelectedList;
            if (list == null)
                return;

            var toInsert = new VerseViewModel()
            {
                Body = CreateVerseVm.Body,
                Reference = CreateVerseVm.Reference.ToBibleReference(),
                Title = CreateVerseVm.Title,
                Date = CreateVerseVm.Date,
                Translation = CreateVerseVm.SelectedTranslation
            };

            list.Verses.Add(toInsert);

            CreateVerseVm.Reset();
        }
Example #4
0
 public void TakeOwnership(VerseViewModel verse)
 {
     UpdateVerse(verse); // A simple update will cause the verse to belong to this list. This method only exists for ease of understanding.
 }