Example #1
0
        public void ModifyDiet(Cat cat)
        {
            if (Equals(null, _model))
            {
                return;
            }
            _dietInProgress = new List <Nom>(cat.NomsAsList);
            Diet dlg = new Diet(this, cat, _dietInProgress);

            try
            {
                if (DialogResult.OK == dlg.ShowDialog())
                {
                    cat.NomsICanEat.Clear();
                    foreach (Nom nom in _dietInProgress)
                    {
                        cat.NomsICanEat.Add(nom);
                    }
                    _model.SaveObject <Cat>(cat);
                }
            }
            finally
            {
                dlg.Close();
            }
        }