public void Add(Author author) { EventArgs ev = new EventArgs(); _authorRepository.Add(author); OnChanged(this, ev); }
/// <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); }
/// <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()); } }
public void AddAuthor(Author author) { authorRepository.Add(author); if (Updated != null) { Updated(this, EventArgs.Empty); } }
// 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); }
public void AddAuthor(string name) { Author author = new Author(); author.Name = name; _authorRepository.Add(author); EventArgs args = new EventArgs(); OnUpdated(args); }
public void Add(string name) { if (String.IsNullOrEmpty(name)) { throw new FormatException("Name can't be empty"); } authorRepository.Add(new Author { Name = name }); OnUpdate(); }
/// <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(); } }
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()); }
public void Add(Author author) { authorRepository.Add(author); OnUpdated(); }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Adds an author to the database. /// </summary> /// <param name="a">Author to be added.</param> public void Add(Author a) { authorRepository.Add(a); }
/// <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. }