Ejemplo n.º 1
0
 public void BookInfo(MyBookLibrary book)
 {
     Console.WriteLine("Book's ID: " + book.ID);
     Console.WriteLine("Book's Name: " + book.Name);
     Console.WriteLine("Book's Publisher: " + book.Publisher);
     Console.WriteLine("Book's Price: " + book.Price);
 }
Ejemplo n.º 2
0
        public static void Deletebook(string ID)
        {
            MyBookLibrary book = SearchBook(ID);

            if (book != null)
            {
                BookList.Remove(book);
                Console.WriteLine("Xoa sach thanh cong");
            }
        }
Ejemplo n.º 3
0
        public static MyBookLibrary SearchBook(string ID)
        {
            MyBookLibrary Book = null;

            foreach (var book in BookList)
            {
                if (ID == book.ID)
                {
                    Book = book;
                }
            }
            return(Book);
        }
Ejemplo n.º 4
0
        public static void UpdateBook(string ID)
        {
            MyBookLibrary book = SearchBook(ID);

            if (book != null)
            {
                Console.WriteLine("Ma sach: " + book.ID);
                Console.WriteLine("Nhap ten sach: ");
                book.Name = Console.ReadLine();
                Console.WriteLine("Nhap nha san xuat: ");
                book.Publisher = Console.ReadLine();
                Console.WriteLine("Nhap gia sach: ");
                book.Price = Console.ReadLine();
                Console.WriteLine("Cap nhat thong tin sach thanh cong");
            }
            else
            {
                Console.WriteLine("Khong tim thay sach co ma: " + ID);
            }
        }