Exemple #1
0
        void IDeleteBusiness.deleteBook()
        {
            _dataDelete.deleteBook();
            Console.WriteLine("Kindly Enter the book name");
            string bookName = Console.ReadLine();

            bookName = char.ToUpper(bookName[0]) + bookName.Substring(1).ToLower();
            if (bookAndCategoriesData.retBooks().Find(x => x.bookName == bookName && x.Active == true) == null)
            {
                Console.WriteLine("Sorry book doesn't exist.");
            }
            else
            {
                int tempBookCategoryId = bookAndCategoriesData.retBooks().Find(x => x.bookName == bookName && x.Active == true).bookCategoryId;
                bookAndCategoriesData.retBooks().Find(x => x.bookName == bookName && x.Active == true).Active = false;
                bookAndCategoriesData.retcategories().Find(x => x.categoryId == tempBookCategoryId && x.Active == true).cntOfTaggedBooks--;
                Console.WriteLine("Book deleted successfully");
            }
        }