Пример #1
0
        static void Main(string[] args)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("../../simple-query.xml");

            XmlNode query = xmlDoc.SelectSingleNode("/query");

            string title      = GetChildText(query, "title");
            string author     = GetChildText(query, "author");
            string isbnString = GetChildText(query, "isbn");
            long?  isbn       = null;

            if (isbnString != null)
            {
                isbn = long.Parse(isbnString);
            }

            List <BookReviewsData> booksReviewsData = BooksDAL.FindBooksAndGetReviews(title, author, isbn);

            if (booksReviewsData.Count == 0)
            {
                Console.WriteLine("Nothing found");
            }
            else
            {
                foreach (BookReviewsData bookData in booksReviewsData)
                {
                    string reviewsCount = "Nothing found";
                    if (bookData.ReviewsCount > 0)
                    {
                        reviewsCount = bookData.ReviewsCount.ToString();
                    }

                    Console.WriteLine("{0} --> {1}", bookData.Title, reviewsCount);
                }
            }
        }