public void CreateAnsweredSurveyQuestionOption(AnsweredSurveyQuestionOption option)
 {
     // Prevent duplicate option entries in this answered survey
     var query = from answeredsurveyquestionoption in db.AnsweredSurveyQuestionOptions
                 select answeredsurveyquestionoption;
     query = query.Where(asvos => asvos.AnsweredSurveyID.Equals(option.AnsweredSurveyID));
     query = query.Where(asvos => asvos.AnsweredSurveyQuestionOptionID.Equals(option.AnsweredSurveyQuestionOptionID));
     List<AnsweredSurveyQuestionOption> answeredsurveyquestionoptions = query.ToList();
     if (answeredsurveyquestionoptions == null || answeredsurveyquestionoptions.Count == 0)
     {
         db.AnsweredSurveyQuestionOptions.Add(option);
         db.SaveChanges();
     }
 }
Пример #2
0
        public int AnsweredSurveyQuestionOption_Create(int answeredsurveyid, int surveyquestionoptionid, bool isselected)
        {
            try
            {
                IAnsweredSurveyQuestionOptionRepository optionrep = new EntityAnsweredSurveyQuestionOptionRepository();

                AnsweredSurveyQuestionOption option = new AnsweredSurveyQuestionOption();
                option.AnsweredSurveyID = answeredsurveyid;
                option.SurveyQuestionOptionID = surveyquestionoptionid;
                option.IsSelected = isselected;

                optionrep.CreateAnsweredSurveyQuestionOption(option);

                return option.AnsweredSurveyQuestionOptionID;
            }
            catch { return 0; }
        }
 public void UpdateAnsweredSurveyQuestionOption(AnsweredSurveyQuestionOption answeredsurveyquestionoption)
 {
     db.Entry(answeredsurveyquestionoption).State = EntityState.Modified;
     db.SaveChanges();
 }