public Student LendBook(Student student, Book book) { var newBook = book; //newBook.BorrowTime = DateTime.Now; student.BookId.Add(book.Id); return student; }
public Student ReturnBook(Student student, Book book) { // TO DO CHECK FOR VALID ID var lookupId = book.Id; student.BookId.Remove(student.BookId.First(x => x.Equals(lookupId))); return student; }
public static void AddBook(Book book) { var db = XmlHandler.GetDB(); //Sorting by Id, getting highest and adding 1 db.BookList.Add(book); XmlHandler.SaveDB(db); MessageBox.Show("Książka " + book.Name + " " + " została dodana do bazy danych!"); }
public AddBook(Book book) { InitializeComponent(); addButton.Click -= addButton_Click; addButton.Click += editButton_Click; addButton.Text = "Edytuj"; numberTextBox.Text = book.Id; titleTextBox.Text = book.Name; publisherTextBox.Text = book.Publisher; classTextBox.Text = book.Class; valueTextBox.Text = book.Value.ToString(); noteRichTextBox.Text = book.Notes; editedBook = book; }
private static DataGridViewRow FillRow(Book book) { var row = new DataGridViewRow(); for (var i = 0; i < 7; i++) { row.Cells.Add(new DataGridViewTextBoxCell()); } row.Cells[0].Value = book.Id; row.Cells[1].Value = book.Name; row.Cells[2].Value = book.Publisher; row.Cells[3].Value = book.Class; row.Cells[4].Value = book.Value; row.Cells[5].Value = book.TimeAdded.ToShortDateString(); row.Cells[6].Value = book.Notes; return row; }
public static void DeleteBook(Book book, bool prompt) { if (prompt) { var confirmResult = MessageBox.Show("Czy na pewno skasować tę książkę?", "Potwierdź usunięcie", MessageBoxButtons.YesNo); if (confirmResult != DialogResult.Yes) return; } var db = XmlHandler.GetDB(); db.BookList.RemoveAll(x => x.Id == book.Id); XmlHandler.SaveDB(db); if (prompt) MessageBox.Show("Książka " + book.Name + " została skasowana z bazy danych!"); }
public static void EditBook(Book oldBook, Book newBook) { var db = XmlHandler.GetDB(); db.BookList.RemoveAll(x => x.Id == oldBook.Id); db.BookList.Add(newBook); MessageBox.Show("Książka " + newBook.Name +" została wyedytowana!"); }