/// <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(questions questions) { base.AddObject("questions", questions); }
public string StoreQuestion(string IMEI, string EventKey, string content) { int questionID = 0; content = System.Net.WebUtility.HtmlDecode(content); try { var student = (from s in wonderDB.students where s.IMEI == IMEI select new { s.StudentID }).FirstOrDefault(); if (student.StudentID <= 0) { throw new SystemException("Provide an authorized student ID."); } var eventTMP = (from e in wonderDB.events where e.Key == EventKey && e.Status == 0 select new { e.EventID }).FirstOrDefault(); if (eventTMP.EventID <= 0) { throw new SystemException("Provide an active event ID."); } questions question = new questions(); question.Content = content; question.EventID = eventTMP.EventID; question.StudentID = student.StudentID; question.Status = 0; question.IsAccepted = 0; question.CreatedDate = DateTime.Now; wonderDB.questions.AddObject(question); wonderDB.SaveChanges(); questionID = question.QuestionID; } catch (Exception ex) { WriteLog(ex.Message, "StoreQuestion"); return "-1"; } return questionID.ToString(); }
/// <summary> /// Create a new questions object. /// </summary> /// <param name="questionID">Initial value of the QuestionID property.</param> public static questions Createquestions(global::System.Int32 questionID) { questions questions = new questions(); questions.QuestionID = questionID; return questions; }