本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToAd方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToAd方法的具体用法?C# DataEntities.AddToAd怎么用?C# DataEntities.AddToAd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToAd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btn_Save_Click
protected void btn_Save_Click(object sender, EventArgs e)
{
long id = WS.RequestLong("id");
using (DataEntities ent = new DataEntities())
{
Voodoo.Basement.Ad ad = new Voodoo.Basement.Ad();
try
{
ad = (from l in ent.Ad where l.ID == id select l).First();
}
catch { }
ad.GroupID = ddl_Group.SelectedValue.ToInt32();
ad.Title = txt_Title.Text;
ad.Url = txt_Url.Text;
var adgroup = (from l in ent.AdGroup where l.ID == ad.GroupID select l).FirstOrDefault();
ad.width = adgroup.width;
ad.height = adgroup.height;
if (ad.ID <= 0)
{
ent.AddToAd(ad);
}
ent.SaveChanges();
if (FileUpload1.HasFile)
{
string fileName = string.Format("/u/Ad/{0}.jpg", ad.ID.ToS());
BasePage.UpLoadImage(FileUpload1.PostedFile, fileName, ad.width.ToInt32(), ad.height.ToInt32());
ad.Image = fileName;
ent.SaveChanges();
}
}
Js.AlertAndChangUrl("保存成功!", "List.aspx");
}