예제 #1
0
        private static void addingBookFeature()
        {
            Book bk = new Book();

            bk.BookID = MyConsole.getNumber("Enter the ISBN no of this book");
            bk.Title  = MyConsole.getString("Enter the title of this book");
            bk.Author = MyConsole.getString("Enter the Author of this book");
            bk.Price  = MyConsole.getDouble("Enter the Price of this book");
            try
            {
                bool result = mgr.AddNewBook(bk);
                if (!result)
                {
                    Console.WriteLine("No more books could be added");
                }
                else
                {
                    Console.WriteLine($"Book by title {bk.Title} is added successfully to the database");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
        private static void updatingBookFeature()
        {
            Book bk = new Book();

            bk.BookID = MyConsole.getNumber("Enter the ISBN no of the book U wish to update");
            bk.Title  = MyConsole.getString("Enter the new title of this book");
            bk.Author = MyConsole.getString("Enter the new Author of this book");
            bk.Price  = MyConsole.getDouble("Enter the new Price of this book");
            bool result = mgr.UpdateBook(bk);

            if (!result)
            {
                Console.WriteLine($"No book by this id {bk.BookID} found to update");
            }
            else
            {
                Console.WriteLine($"Book by ID {bk.BookID} is updated successfully to the database");
            }
        }