public long SaveQuestion(question newQuestion) { using (var context = new TreasureHuntEntities()) { context.questions.AddObject(newQuestion); context.SaveChanges(); context.ObjectStateManager.ChangeObjectState(newQuestion, System.Data.EntityState.Added); return newQuestion.QuestionId; } }
/// <summary> /// Deprecated Method for adding a new object to the questions EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToquestions(question question) { base.AddObject("questions", question); }
/// <summary> /// Create a new question object. /// </summary> /// <param name="questionId">Initial value of the QuestionId property.</param> /// <param name="question1">Initial value of the Question1 property.</param> /// <param name="uRL">Initial value of the URL property.</param> public static question Createquestion(global::System.Int64 questionId, global::System.String question1, global::System.String uRL) { question question = new question(); question.QuestionId = questionId; question.Question1 = question1; question.URL = uRL; return question; }
public void UpdateQuestion(question updatedQuestion) { using (var context = new TreasureHuntEntities()) { context.questions.AddObject(updatedQuestion); context.SaveChanges(); context.ObjectStateManager.ChangeObjectState(updatedQuestion, System.Data.EntityState.Modified); } }