public void CreateQuestions(List <SurveyQuestion> surveyQuestions) { using (var landingPageContext = new LandingPage()) { foreach (var item in surveyQuestions) { landingPageContext.SurveyQuestionEntities.Add(item); landingPageContext.SaveChanges(); } } }
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(); } } }
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); } }
public void CreateEntry(Visitor user) { using (var landingPageContext = new LandingPage()) { landingPageContext.VisitorEntities.Add(user); } }