//ADD BOOK INTO BOOK TABLE private void AddBook() { try { Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("Enter book details.."); Console.ForegroundColor = ConsoleColor.White; Console.Write("Book Id: "); book.BookId = int.Parse(Console.ReadLine()); Console.Write("Book Name: "); book.BookName = Console.ReadLine(); Console.Write("Book Author: "); book.BookAuthor = Console.ReadLine(); Console.Write("Book Copies: "); book.BookCopies = int.Parse(Console.ReadLine()); BookBLL addBook = new BookBLL(); addBook.AddBookBLL(book.BookId, book.BookName, book.BookAuthor, book.BookCopies); } catch (FormatException) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Enter a valid input"); Console.ForegroundColor = ConsoleColor.White; } catch (LibraryMSException) { throw new LibraryMSException("Some unknown exception is occured.."); } }
public void AddBook() { try{ Console.WriteLine("Wprowadź dane książki..."); Console.Write("Numer Id: "); book.BookId = int.Parse(Console.ReadLine()); Console.Write("Tytuł: "); book.BookName = Console.ReadLine(); Console.Write("Imię autora: "); book.BookAuthorName = Console.ReadLine(); Console.Write("Nazwisko autora: "); book.BookAuthorSurname = Console.ReadLine(); Console.Write("Data wydania książki: "); book.BookDate = DateTime.Parse(Console.ReadLine()); BookBLL addBook = new BookBLL(); addBook.AddBookBLL(book.BookId, book.BookName, book.BookAuthorName, book.BookAuthorSurname, book.BookDate); } catch (FormatException) { Console.WriteLine("Wprowadź poprawne dane"); } }