Exemplo n.º 1
0
        public void TestSaveMethod()
        {
            Person marge = new Person("marge", "simpson", "234567890", "*****@*****.**", Gender.FEMALE);

            Assert.IsTrue(persMgr.SavePerson(marge));

            // Cleanup
            persMgr.DeletePerson(marge.FirstName, marge.LastName);
        }
Exemplo n.º 2
0
        // Saves the customer to the repository.  This method is invoked by the SaveCommand.
        private void Save()
        {
            if (!_person.Validate())
            {
                _labelMessage = "Cannot Save, Invalid Person";
                base.OnPropertyChanged("LabelMessage");
                return;
            }

            if (this.IsNewPerson)
            {
                if (_persMgr.SavePerson(_person))
                {
                    // Success
                    _labelMessage = String.Format("Saved {0} {1}", _person.FirstName, _person.LastName);
                    base.OnPropertyChanged("LabelMessage");
                }
                else
                {
                    // Error
                    _labelMessage = String.Format("Error Occured Saving Person");
                    base.OnPropertyChanged("LabelMessage");
                }
            }
            else
            {
                // Person already exists
                _labelMessage = String.Format("Person already exists");
                base.OnPropertyChanged("LabelMessage");
            }
        }