예제 #1
0
        public bool AddNewBook(Book book)
        {
            Console.WriteLine(book.Title);

            try
            {
                if (BookAccessor.InsertBook(book))
                {
                    return(true);
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(false);
        }
        public bool SaveNewBook(Book book)
        {
            var result = false;

            if (book.ISBN == "" || book.Title == "" || book.Edition == "" ||
                book.EditionYear == 0 || book.CategoryID == null ||
                book.AuthorID < 10000)
            {
                throw new ApplicationException("You must fill out all the fields.");
            }
            try
            {
                result = (0 != BookAccessor.InsertBook(book));
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }