Exemple #1
0
        /// <summary>
        /// 删除章节
        /// </summary>
        /// <param name="id">章节ID</param>
        protected void ChapterDelete(long id)
        {
            try
            {
                var   c   = BookChapterView.GetModelByID(id.ToS());
                var   b   = BookView.GetModelByID(c.BookID.ToS());
                Class cls = BookView.GetClass(b);
                Voodoo.IO.File.Delete(Server.MapPath(BasePage.GetBookChapterTxtUrl(c, cls)));
                BookChapterView.DelByID(id);

                var lastChapter = BookChapterView.Find("BookId={0} order by ChapterIndex,id desc");
                b.UpdateTime       = lastChapter.UpdateTime;
                b.LastChapterID    = lastChapter.ID;
                b.LastChapterTitle = lastChapter.Title;
                BookView.Update(b);

                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(true));
            }
            catch (System.Exception e)
            {
                Response.Clear();
                Response.Write(Voodoo.IO.XML.Serialize(false));
            }
        }