コード例 #1
0
        public void Add(Author author)
        {
            EventArgs ev = new EventArgs();

            _authorRepository.Add(author);
            OnChanged(this, ev);
        }
コード例 #2
0
        /// <summary>
        /// Adds author to database and notifies subscribers of the update.
        /// </summary>
        /// <param name="a">Author to be added to DB</param>
        public void Add(Author a)
        {
            authorRepository.Add(a);
            var e = EventArgs.Empty;

            OnUpdated(e);
        }
コード例 #3
0
 /// <summary>
 /// Method to add an author to the database.
 /// </summary>
 /// <param name="author">Author</param>
 public void AddAuthor(Author author)
 {
     authorRepository.Add(author);
     if (null != Updated)
     {
         Updated.Invoke(this, new EventArgs());
     }
 }
コード例 #4
0
        public void AddAuthor(Author author)
        {
            authorRepository.Add(author);

            if (Updated != null)
            {
                Updated(this, EventArgs.Empty);
            }
        }
コード例 #5
0
ファイル: AuthorService.cs プロジェクト: LinusHuzell/Library
 // Standard query-methods implemented by the IService interface (CRUD functions). -->
 /// <summary>
 /// Validates and sends an author object to repository for adding to database and then raises the OnUpdated event.
 /// </summary>
 /// <param name="author">Author object to be added to database.</param>
 public void Add(Author author)
 {
     if (Exists(author.FirstName, author.LastName))
     {
         throw new OperationCanceledException("Cancelled. Author already exists.");
     }
     AuthorRepository.Add(author);
     OnUpdated(author, EventArgs.Empty);
 }
コード例 #6
0
ファイル: AuthorService.cs プロジェクト: frite1/Library
        public void AddAuthor(string name)
        {
            Author author = new Author();

            author.Name = name;
            _authorRepository.Add(author);
            EventArgs args = new EventArgs();

            OnUpdated(args);
        }
コード例 #7
0
 public void Add(string name)
 {
     if (String.IsNullOrEmpty(name))
     {
         throw new FormatException("Name can't be empty");
     }
     authorRepository.Add(new Author {
         Name = name
     });
     OnUpdate();
 }
コード例 #8
0
ファイル: AuthorService.cs プロジェクト: mrSten/Library
 /// <summary>
 /// Adds and author
 /// </summary>
 /// <param name="a">The author to be added</param>
 public void Add(Author a)
 {
     if (a.Name != null && a != null)
     {
         authorRepository.Add(a);
         OnChanged(EventArgs.Empty);
     }
     else
     {
         throw new ArgumentNullException();
     }
 }
コード例 #9
0
        public void Add(string name)
        {
            if (name == null || name.Length < 5 || name.Length > 25)
            {
                System.Windows.Forms.MessageBox.Show("Please type a name between 5 and 25 characters");
            }
            else
            {
                _authorRepository.Add(new Author()
                {
                    Name = name
                });
            }

            OnUpdate(new EventArgs());
        }
コード例 #10
0
 public void Add(Author author)
 {
     authorRepository.Add(author);
     OnUpdated();
 }
コード例 #11
0
 /// <summary>
 /// Uses the Author repository to add a new Author object to the database and then raises the Updated() event.
 /// </summary>
 /// <param name="a">The Author object to be added to the database.</param>
 public void Add(Author a)
 {
     authorRepository.Add(a);
     OnUpdated(this, EventArgs.Empty);
 }
コード例 #12
0
 /// <summary>
 /// Adds an author to the repository
 /// </summary>
 /// <param name="author">The author to add</param>
 public void Add(Author author)
 {
     authorRepository.Add(author);
     OnUpdated(this, eventArgs);
 }
コード例 #13
0
 /// <summary>
 /// Calls Add method in AuthorRepository
 /// Raises Updated event
 /// </summary>
 /// <param name="item"></param>
 public void Add(Author item)
 {
     authorRepository.Add(item);
     OnUpdated(EventArgs.Empty);
 }
コード例 #14
0
 /// <summary>
 /// Adds an author to the database.
 /// </summary>
 /// <param name="a">Author to be added.</param>
 public void Add(Author a)
 {
     authorRepository.Add(a);
 }
コード例 #15
0
 /// <summary>
 /// Method to add authors to db
 /// </summary>
 /// <param name="author">Takes an author object</param>
 public void Add(Author author)
 {
     authorRepository.Add(author);
     // TODO: Raise the Updated event.
 }