本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToImageAlbum方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToImageAlbum方法的具体用法?C# DataEntities.AddToImageAlbum怎么用?C# DataEntities.AddToImageAlbum使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToImageAlbum方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btn_Save_Click
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btn_Save_Click(object sender, EventArgs e)
{
Class cls = ClassAction.Classes.Where(p => p.ID.ToString() == ddl_Class.SelectedValue).FirstOrDefault();
DataEntities ent = new DataEntities();
int id=WS.RequestInt("id");
var images = from l in ent.ImageAlbum where l.ID == id select l;
ImageAlbum imga =new ImageAlbum();
if(images.Count()>0)
{
imga=images.FirstOrDefault();
}
imga.ClassID = ddl_Class.SelectedValue.ToInt32();
imga.Title = txt_Title.Text.TrimDbDangerousChar();
imga.AuthorID = ddl_Author.SelectedValue.ToInt32();
imga.Author = ddl_Author.SelectedItem.Text;
imga.ClickCount = txt_ClickCount.Text.ToInt32(0);
if (imga.ID <= 0)
{
imga.CreateTime = DateTime.Now;
imga.Folder = DateTime.Now.ToString("yyyy-MM-dd");
}
imga.Intro = txt_Intro.Text.TrimDbDangerousChar();
imga.KeyWords = txt_Keyword.Text.TrimDbDangerousChar();
imga.ReplyCount = txt_ReplyCount.Text.ToInt32(0);
imga.SetTop = false;
//imga.ShotCut = "";
//imga.Size = 0;
imga.Title = txt_Title.Text;
imga.UpdateTime = DateTime.Now;
imga.ZtID = 0;
if (images.Count()==0)
{
ent.AddToImageAlbum(imga);
ent.SaveChanges();
}
//保存单个图片设置
string[] tits = WS.RequestString("tit[]").Split(',');
string[] intrs = WS.RequestString("intro[]").Split(',');
var imgs = //ImagesView.GetModelList(string.Format("AlbumID={0} order by id", imga.ID));
(from l in ent.Images where l.AlbumID==imga.ID select l).ToList();
for (int i = 0; i < imgs.Count; i++)
{
try
{
imgs[i].Title = tits[i].ToS();
imgs[i].Intro = intrs[i].ToS();
}
catch { }
}
ent.SaveChanges();
//生成页面
CreatePage.CreateContentPage(imga, cls);
ImageAlbum pre = GetPreImage(imga, cls);
if (pre != null)
{
CreatePage.CreateContentPage(pre, cls);
}
CreatePage.CreateListPage(cls, 1);
Js.AlertAndChangUrl("保存成功!", url);
}