Exemplo n.º 1
0
        static void Main(string[] args)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("../../complex-books.xml");
            string xPathQuery = "/catalog/book";

            XmlNodeList booksList = xmlDoc.SelectNodes(xPathQuery);

            foreach (XmlNode bookNode in booksList)
            {
                string title      = bookNode.GetObligatoryChildText("title");
                string isbnString = bookNode.GetChildText("isbn");
                long?  isbn       = null;
                if (isbnString != null)
                {
                    isbn = long.Parse(isbnString);
                }

                string  priceString = bookNode.GetChildText("price");
                decimal?price       = null;
                if (priceString != null)
                {
                    price = decimal.Parse(priceString);
                }

                string webSite = bookNode.GetChildText("web-site");

                List <string> authorNames = GetAuthors(bookNode, "authors/author");

                List <ReviewData> reviews = GerReviews(bookNode, "reviews/review");

                BooksDAL.AddBook(title, isbn, price, webSite, authorNames, reviews);
            }
        }
Exemplo n.º 2
0
        public string PostBooks(BooksEntities books)
        {
            string response;

            try
            {
                using (DBNexosBook db = new DBNexosBook())
                {
                    response = BooksDAL.AddBook(db, books);
                }
            }
            catch (Exception)
            {
                return("No se pudo hacer el registro, consulte a su administrador");

                throw;
            }
            return(response);
        }
Exemplo n.º 3
0
        public void addBook(string Bookname, string Bookyear, string Booksummary, string Booksubject)
        {
            BooksDAL b = new BooksDAL();

            b.AddBook(Bookname, Bookyear, Booksummary, Booksubject);
        }