public InsertOrUpdatePublisherForm(int?publisherId = null) { InitializeComponent(); _database = new MyLibraryDatabase(); if (publisherId.HasValue) { _isUpdate = true; _publisher = _database.GetPublishers(p => p.PublisherId == publisherId).Single(); txtName.Text = _publisher.Name; } }
public InsertOrUpdateBookForm(int?bookId = null) { InitializeComponent(); _database = new MyLibraryDatabase(); cmbPublishers.DataSource = _database.GetPublishers(); if (bookId.HasValue) { _isUpdate = true; _book = _database.GetBooks(b => b.BookId == bookId).Single(); txtName.Text = _book.Name; cmbPublishers.SelectedValue = _book.PublisherId; txtAuthor.Text = _book.Author; dtPublishedOn.Value = _book.PublishedOn; txtISBN.Text = _book.ISBN; txtDescription.Text = _book.Description; } }
private void ReloadPublishers() { dgvPublishers.DataSource = _database.GetPublishers(); }