本文整理汇总了C#中Question.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Question.Save方法的具体用法?C# Question.Save怎么用?C# Question.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question.Save方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveQuestion
public static int SaveQuestion(Question question)
{
question.Title = question.Title.Replace("\n", "<br/>");
question.Help = question.Help.Replace("\n", "<br/>");
question.Save();
return question.Id;
}
示例2: CreateQuestionLoadDontRetrieveLazyAndSave
public void CreateQuestionLoadDontRetrieveLazyAndSave()
{
SetUp();
Question q = new Question();
q.URL = "mumbo-jumbo";
q.Body = "mumbo jumbo";
Answer a1 = new Answer();
q.Answers.Add(a1);
q.Save();
// We want to verify that a non-touched LazyList will not be deleted ...!
Question q2 = Question.SelectByID(q.ID);
q2.Save();
q2 = Question.SelectByID(q.ID);
Assert.IsNotNull(q2.Answers);
Assert.AreEqual(1, q2.Answers.Count);
}
示例3: InsertInfo
public static void InsertInfo()
{
User user = new User();
user.Username = "mario.chavez";
user.Email = "[email protected]";
user.SaveAndFlush();
Question q1 = new Question();
q1.Message = "Pregunta 1";
q1.User = user;
Question q2 = new Question();
q2.Message = "Pregunta 2";
q2.User = user;
q1.Save();
q2.Save();
user.SaveAndFlush();
}
示例4: RequestSavingOfStackedQuestion
protected void RequestSavingOfStackedQuestion(object sender, ActiveEventArgs e)
{
// Saving new question...
Question q = new Question();
q.Body = e.Params["Body"].Get<string>();
q.Header = e.Params["Header"].Get<string>();
q.Save();
// Updating User's score with points for question
User u = User.SelectFirst(Criteria.Eq("Username", Users.LoggedInUserName));
u.Score += Settings.Instance.Get<int>("UserScoreForNewQuestion", 6);
u.Save();
ShowQuestionsLandingPage();
}