private void btnAdd_Click(object sender, RoutedEventArgs e) { string ISBN = txtISBN.Text; string title = tbTitel.Text; string publisher = tbPublisher.Text; string author = tbAuthor.Text; string stringpages = tbPages.Text; int pages = Convert.ToInt32(stringpages); string stringyear = tbYear.Text; int year = Convert.ToInt32(stringyear); controller.AddBook(ISBN, title, pages, year, publisher, author); this.Close(); }
private void AddBooks() { Console.Out.WriteLine("Enter book name"); PrintInputCharacter(); string bookname = Console.In.ReadLine(); Console.Out.WriteLine("Enter book details"); PrintInputCharacter(); string detail = Console.In.ReadLine(); Console.Out.WriteLine("Enter book amount"); PrintInputCharacter(); uint amount = UInt32.Parse(Console.In.ReadLine()); if (controller.CheckBookNameExists(bookname)) { Console.Out.WriteLine("Bookname exists, please change a new bookname"); } else { controller.AddBook(bookname, detail, amount); Console.Out.WriteLine("Add book success"); } }