コード例 #1
0
 public void CreateQuestions(List <SurveyQuestion> surveyQuestions)
 {
     using (var landingPageContext = new LandingPage())
     {
         foreach (var item in surveyQuestions)
         {
             landingPageContext.SurveyQuestionEntities.Add(item);
             landingPageContext.SaveChanges();
         }
     }
 }
コード例 #2
0
 public void CreateOptions(int QuestionId, List <SurveyQuestionOption> optionList)
 {
     for (int i = 0; i < optionList.Count; i++)
     {
         var obj = optionList[i];
         obj.SurveyQuestionId = QuestionId;
         using (var landingPageContext = new LandingPage())
         {
             landingPageContext.SurveyQuestionOptionEntities.Add(obj);
             landingPageContext.SaveChanges();
         }
     }
 }
コード例 #3
0
 public List <object> GetSurveyQuestionList()
 {
     using (var landingPageContext = new LandingPage())
     {
         List <object> objectlist = new List <object> {
             new { Question = string.Empty, Options = new List <SurveyQuestionOption>() }
         };
         List <SurveyQuestion> surveyquestionlist = landingPageContext.SurveyQuestionEntities.ToList();
         objectlist.RemoveAt(0);
         foreach (var item in surveyquestionlist)
         {
             objectlist.Add(new
             {
                 Question = item.Question,
                 Options  = landingPageContext.SurveyQuestionOptionEntities.Where(x => x.SurveyQuestionId == item.Id).ToList()
             });
         }
         return(objectlist);
     }
 }
コード例 #4
0
 public void CreateEntry(Visitor user)
 {
     using (var landingPageContext = new LandingPage()) {
         landingPageContext.VisitorEntities.Add(user);
     }
 }