本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToClass方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToClass方法的具体用法?C# DataEntities.AddToClass怎么用?C# DataEntities.AddToClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
string ClassName=WS.RequestString("class");
int Model=WS.RequestInt("m",4);
if (ClassName.Length == 0)
{
return;
}
Class cls = ClassAction.Classes.Where(p => p.ClassName == ClassName && p.ModelID == Model).FirstOrDefault();
if (cls.ID <= 0)
{
//cls.ClassForder = PinyinHelper.GetPinyin(ClassName);
cls.ClassForder = ClassName;
cls.ClassKeywords = ClassName;
cls.ClassName = ClassName;
cls.ModelID = Model;
cls.IsLeafClass = true;
cls.ModelID = Model;
cls.ShowInNav = true;
using (DataEntities ent = new DataEntities())
{
ent.AddToClass(cls);
ent.SaveChanges();
Voodoo.Cache.Cache.Clear("_NewClassList");
}
}
Response.Clear();
Response.Write(Voodoo.IO.XML.Serialize(cls));
}
示例2: ClassInsert
public Class ClassInsert(Class cls)
{
using (DataEntities ent = new DataEntities())
{
ent.AddToClass(cls);
ent.SaveChanges();
return cls;
}
}
示例3: GetClass
/// <summary>
/// 获取栏目
/// </summary>
/// <param name="ClassName">栏目名称</param>
/// <param name="ModelID">模型 1新闻 2图片 3问答 4小说</param>
protected void GetClass(string ClassName, int ModelID)
{
DataEntities ent = new DataEntities();
Class cls = (from l in ent.Class where l.ModelID == ModelID && l.ClassName == ClassName select l).FirstOrDefault();
if (cls.ID <= 0)
{
//cls.ClassForder = PinyinHelper.GetPinyin(ClassName);
cls.ClassForder = ClassName;
cls.ClassKeywords = ClassName;
cls.ClassName = ClassName;
cls.ModelID = ModelID;
cls.IsLeafClass = true;
cls.ModelID = ModelID;
cls.ShowInNav = true;
ent.AddToClass(cls);
}
ent.SaveChanges();
ent.Dispose();
Voodoo.Cache.Cache.Clear("_NewClassList");
Response.Clear();
Response.Write(Voodoo.IO.XML.Serialize(cls));
}