本文整理汇总了C#中Voodoo.Basement.DataEntities.AddToAnswer方法的典型用法代码示例。如果您正苦于以下问题:C# DataEntities.AddToAnswer方法的具体用法?C# DataEntities.AddToAnswer怎么用?C# DataEntities.AddToAnswer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voodoo.Basement.DataEntities
的用法示例。
在下文中一共展示了DataEntities.AddToAnswer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveAnswer
protected void SaveAnswer(int QuestionID, string UserName, string Tel, string Content)
{
DataEntities ent = new DataEntities();
Answer a = new Answer();
a.Agree = 0;
a.AnswerTime = DateTime.UtcNow.AddHours(8);
a.Content = Content;
//a.Email = "";
a.QuestionID = QuestionID;
//a.Tel = Tel;
a.UserName = UserName;
a.UserID = 0;
ent.AddToAnswer(a);
ent.SaveChanges();
ent.Dispose();
Js.AlertAndGoback("消息已经发送,感谢您的支持!");
}
示例2: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
DataEntities ent = new DataEntities();
User u = UserAction.opuser;
if (u.ID <= 0)
{
Js.AlertAndGoback("对不起,您没有登录,请登录后回答!");
return;
}
int qid = WS.RequestInt("qid");
string content = WS.RequestString("content");
if (qid <= 0)
{
Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!");
return;
}
Question q = (from l in ent.Question where l.ID == qid select l).FirstOrDefault();
Class cls = q.GetClass();
if (UserAction.HasPostRight(cls.ID) == false)
{
Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!");
return;
}
Answer a = new Answer();
a.Agree = 0;
a.AnswerTime = DateTime.Now;
a.Content = content;
a.QuestionID = qid;
a.UserID = u.ID;
a.UserName = u.UserName;
ent.AddToAnswer(a);
CreatePage.CreateContentPage(q, q.GetClass());//创建内容页
ent.Dispose();
string url = BasePage.GetQuestionUrl(q, q.GetClass());
Js.AlertAndChangUrl("回答成功!", url);
}