Beispiel #1
0
        public void AddEntry( Entry e )
        {
            if ( !Entries.Any ( p => p.Title == e.Title ) )
            {
                Entries.Add ( e );

                isUnsavedChanges = true;
            }
            else
            {
                throw new ArgumentException (
                    "An entry with the title, '" +
                    e.Title + "' already exists.  Titles must be unique" );
            }
        }
Beispiel #2
0
 public void DeleteEntry( Entry e )
 {
     // find first in case fields (other than Id) have been edited)
     Entry toDel = Entries.First<Entry> ( p => p.Id == e.Id );
     Entries.Remove ( toDel );
 }
Beispiel #3
0
        public void UpdateEntry( Entry e )
        {
            Entry existingEntry = Entries.FirstOrDefault ( p => p.Id == e.Id );
            if ( existingEntry != null )
            {
                existingEntry.Login = e.Login;
                existingEntry.Password = e.Password;
                existingEntry.Note = e.Note;

                isUnsavedChanges = true;
            }
            else
            {
                throw new ArgumentException (
                    "Cannot find an entry with the title, '" +
                    e.Title + "'. Update Failed." );
            }
        }