Пример #1
0
        public void Insert(Book book)
        {
            var bookId = DB.ExecuteScalar <long>("insert into book values(NULL,?,date(?),?,?); select last_insert_rowid()",
                                                 book.Name,
                                                 book.PublishDate,
                                                 book.OfficialHref,
                                                 book.Introduction);

            book.Hrefs.ForEach(href => AddHrefToBook(bookId, href));
            book.Categorys.ForEach(category => AddCategoryToBook(bookId, category));
            book.Tags.ForEach(tag => AddTagToBook(bookId, tag));
        }
Пример #2
0
        public long Insert(Book book)
        {
            //添加book的基本信息
            var bookId = DB.ExecuteScalar <long>("insert into book values(NULL,?,date(?),?,?); select last_insert_rowid()",
                                                 book.Name,
                                                 book.PublishDate,
                                                 book.OfficialHref,
                                                 book.Introduction);

            //添加book的标签、分类和超链接
            book.Hrefs.ForEach(href => AddHrefToBook(bookId, href));
            book.Categorys.ForEach(category => AddCategoryToBook(bookId, category));
            book.Tags.ForEach(tag => AddTagToBook(bookId, tag));
            Logger.Debug($"Insert book {book.Name} successful");
            return(bookId);
        }
Пример #3
0
        public bool CheckAlbum(int xid)
        {
            var r = db.ExecuteScalar(@"select * from album where album.x_id=@XId", new SQLiteParameter("@XId", xid));

            return(r == null ? false : true);
        }