private static void InputBookAuthor() { Console.WriteLine("nhap so tac gia can them : "); int n = int.Parse(Console.ReadLine()); for (int i = 0; i < n; i++) { BookAuthor bookAuthor = new BookAuthor(); bookAuthor.InputBookAuthor(listAuthor); listAuthor.Add(bookAuthor); } }
private static void InputBook() { Console.WriteLine("nhap cuon so sach can them : "); int n = int.Parse(Console.ReadLine()); for (int k = 0; k < n; k++) { Book book = new Book(); book.InputBook(listAuthor); Boolean timkiem = false; // kiem tra xem tac gia da ton tai hay chua for (int j = 0; j < listAuthor.Count; j++) { if (listAuthor[j].Pseudonym.Equals(book.Pseudonym)) { timkiem = true; break; } } // chua ton tai tao ms if (!timkiem) { Console.WriteLine("nhap thong tin tac gia ........"); BookAuthor author = new BookAuthor(); author.InputAuthor(); //luu thong ti tac gia listAuthor.Add(author); } listBook.Add(book); } }