示例#1
0
        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();
        }
示例#2
0
        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}");
        }
示例#3
0
 public void DeleteBook(int id)
 {
     _bookRepo.DeleteBook(id);
 }
示例#4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     repo.DeleteBook(int.Parse(lblId.Text.Substring(lblId.Text.LastIndexOf(' ') + 1)));
     LoadBooks();
 }
示例#5
0
 public void RemoveBookById(int id)
 {
     _bookRepo.DeleteBook(id);
 }