本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToBook方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToBook方法的具体用法?C# DataEntities.AddToBook怎么用?C# DataEntities.AddToBook使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToBook方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BookInsert
public Book BookInsert(Book book)
{
using (DataEntities ent = new DataEntities())
{
ent.AddToBook(book);
ent.SaveChanges();
return book;
}
}
示例2: BookAdd
/// <summary>
/// 添加书籍
/// </summary>
/// <param name="Title">标题</param>
/// <param name="Author">作者</param>
/// <param name="ClassID">类别ID</param>
/// <param name="Intro">简介</param>
/// <param name="Length">长度</param>
protected void BookAdd(string Title, string Author, int ClassID, string Intro, long Length)
{
string ClassName = ObjectExtents.Class(ClassID).ClassName;
DataEntities ent=new DataEntities();
Book b = new Book();
if (Title.IsNullOrEmpty() && (from l in ent.Book where l.Title==Title && l.Author==Author select l).Count()>0)
{
b.ID = int.MinValue;
Response.Clear();
Response.Write(Voodoo.IO.XML.Serialize(b));
return;
}
b.Addtime = DateTime.UtcNow.AddHours(8);
b.Author = Author;
b.ClassID = ClassID;
b.ClassName = ClassName;
b.ClickCount = 0;
b.CorpusID = 0;
b.Enable = true;
b.FaceImage = "";
b.Intro = Intro;
b.IsFirstPost = false;
b.IsVip = false;
b.LastChapterID = 0;
b.LastVipChapterID = 0;
b.Length = Length;
b.ReplyCount = 0;
b.SaveCount = 0;
b.Status = 0;//连载中
b.Title = Title;
b.UpdateTime = DateTime.UtcNow.AddHours(8);
b.VipUpdateTime = DateTime.UtcNow.AddHours(8);
b.ZtID = 0;
var books = (from l in ent.Book where l.Title == Title && l.Author == Author select l).ToList();
if (books.Count == 0)
{
ent.AddToBook(b);
ent.SaveChanges();
}
else
{
b = books.FirstOrDefault();
}
ent.Dispose();
Response.Clear();
Response.Write(Voodoo.IO.XML.Serialize(b));
}
示例3: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
var books = (from l in ent.Book where l.ID == id select l).ToList();
Voodoo.Basement.Book book = new Voodoo.Basement.Book();
if (books.Count > 0)
{
book = books.FirstOrDefault();
}
book.Title = txt_Title.Text;
book.Author = txt_Author.Text;
book.ClassID = ddl_CLass.SelectedValue.ToInt32();
book.ClassName = ddl_CLass.SelectedItem.Text;
book.ClickCount = txt_ClickCount.Text.ToInt32();
book.CorpusID = 0;
book.CorpusTitle = "";
book.Enable = chk_Enable.Checked;
//book.FaceImage=
book.Intro = txt_Intro.Text;
book.IsFirstPost = chk_IsFirstpost.Checked;
book.IsVip = chk_IsVip.Checked;
book.Length = txt_Length.Text.ToInt32();
book.ReplyCount = txt_Replycount.Text.ToInt32();
book.SaveCount = txt_SaveCount.Text.ToInt32();
book.Status = ddl_Status.SelectedValue.ToByte();
book.TjCount = txt_TjCount.Text.ToInt32();
book.ZtID = 0;
book.ZtName = "";
if (books.Count == 0)
{
book.Addtime = DateTime.UtcNow.AddHours(8);
book.UpdateTime = DateTime.UtcNow.AddHours(8);
book.VipUpdateTime = DateTime.UtcNow.AddHours(8);
ent.AddToBook(book);
ent.SaveChanges();
}
//Deal Book face image
if (file_Bookfacefile.FileName.IsNullOrEmpty() == false)
{
file_Bookfacefile.SaveAs(Server.MapPath("/Book/BookFace/" + book.ID + ".jpg"));
book.FaceImage = "/Book/BookFace/" + book.ID + ".jpg";
ent.SaveChanges();
}
CreatePage.CreateContentPage(book, book.GetClass());
Response.Redirect("BookList.aspx?class=" + cls.ToS());
}