public void Delete(long SurveyID) { Survey surveyToDelete = (from survey in DatabaseModel.Survey where survey.SurveyID == SurveyID select survey).First(); using (QuestionController questionController = new QuestionController(DatabasePath)) questionController.DeleteAll(SurveyID); using (ResultController resultController = new ResultController(DatabasePath)) resultController.DeleteAllWithSurveyID(SurveyID); DatabaseModel.Survey.Remove(surveyToDelete); DatabaseModel.SaveChanges(); }
public List <Question> GetQuestions(long AttitudeID) { List <AttitudeDefinition> attitudeDefinition; attitudeDefinition = (from attitudedefinition in DatabaseModel.AttitudeDefinition where attitudedefinition.AttitudeID == AttitudeID select attitudedefinition).ToList(); using (QuestionController questionController = new QuestionController(DatabasePath)) { List <Question> questions = new List <Question>(); foreach (AttitudeDefinition currentAttitudeDefinition in attitudeDefinition) { Question questionToAdd = questionController.Get(currentAttitudeDefinition.QuestionID); questions.Add(questionToAdd); } return(questions); } }