private void BtnDelete_Click(object sender, EventArgs e) { Book book = new Book(); book.Id = int.Parse(lblId.Text); book.Title = txtTitle.Text; book.Author = txtAuthor.Text; book.Price = decimal.Parse(txtPrice.Text); book.Description = txtDescription.Text; book.CountryId = 2; BookRepo repo = new BookRepo(); repo.DeleteBook(book.Id); LoadBooks(); }
static void Main(string[] args) { var connection = ConnectionManager.GetConnection(); var bookRepo = new BookRepo(connection); var book = new Book { Title = "Mizerabilii", PublisherId = 5, Year = 1985, Price = 10000 }; var id = bookRepo.InsertBook(book); Console.WriteLine($"Id of inserted book is: {id}"); bookRepo.UpdateBook(); bookRepo.DeleteBook(); Book b = bookRepo.SelectBook(); Console.WriteLine($"Book selected: {b.Title} with price of {b.Price}"); }
public void DeleteBook(int id) { _bookRepo.DeleteBook(id); }
private void btnDelete_Click(object sender, EventArgs e) { repo.DeleteBook(int.Parse(lblId.Text.Substring(lblId.Text.LastIndexOf(' ') + 1))); LoadBooks(); }
public void RemoveBookById(int id) { _bookRepo.DeleteBook(id); }