Exemplo n.º 1
0
        private void UpdateBookMenu()
        {
            string id, name, publisher;
            float  price;

            id = GetInput.GetString("Nhap id Can cap nhat: ", "Vui long nhap lai");

            if (BookLibary.FindBookByID(id) == null)
            {
                Console.WriteLine("No Book with that ID In DB");
            }
            else
            {
                name      = GetInput.GetString("Nhap Ten sach", "Vui long nhap lai");
                publisher = GetInput.GetString("Nhap Publisher", "Vui long nhap lai");
                Console.Write("Nhap gia tien: ");
                price = float.Parse(Console.ReadLine());
                if (BookLibary.Update(id, name, publisher, price))
                {
                    Console.WriteLine("Cap nhat thanh cong");
                }
                else
                {
                    Console.WriteLine("Loi khi cap nhat");
                }
            }
        }
Exemplo n.º 2
0
        public void RemoveBookMEnu()
        {
            string id;

            id = GetInput.GetString("Nhap id Can cap nhat: ", "Vui long nhap lai");

            if (BookLibary.FindBookByID(id) == null)
            {
                Console.WriteLine("No Book with that ID In DB");
            }
            else
            {
                string confirm;
                Console.WriteLine("You want to delete yes/no");
                confirm = Console.ReadLine();
                if (confirm.ToLower().StartsWith("yes") ||
                    confirm.ToLower().StartsWith("y"))
                {
                    if (BookLibary.Delete(id))
                    {
                        Console.WriteLine("Xoa thanh cong");
                    }
                    else
                    {
                        Console.WriteLine("Loi khi xoa");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void AddBookMenu()
        {
            string id, name, publisher;
            float  price;

            id = GetInput.GetString("Nhap ID", "Vui long nhap lai");
            //check student was in List
            if (BookLibary.FindBookByID(id) != null)
            {
                Console.WriteLine("That Book was exsits");
                return;
            }
            name      = GetInput.GetString("Nhap ten sach", "Vui long nhap lai");
            publisher = GetInput.GetString("Nhap Publisher", "Vui long nhap lai");
            Console.Write("Nhap gia tien: ");
            price = float.Parse(Console.ReadLine());

            if (BookLibary.Add(id, name, publisher, price))
            {
                Console.WriteLine("Add successful");
            }
            else
            {
                Console.WriteLine("'Loi khi add, vui long thu lai");
            }
        }