public void DeleteSurvey(string surveyCode) { surveys survey = surveyDAL.GetSurveyBySurveyCode(surveyCode); List <questions> questions = questionDAL.GetQuestionsBySurveyId(survey.Id).ToList(); foreach (var question in questions) { if (inputTypeDAL.GetInputTypeName(question) == "text") { List <text_answers> texts = textAswersDAL.GetTextAnswers(question); foreach (var text in texts) { textAswersDAL.DeleteTextAnswer(text); } questionDAL.DeleteQuestion(question); } else { List <option_choices> options = optionChoiceDAL.GetOptionsChoices(question); foreach (var option in options) { List <answers> answers = answerDAL.GetAnswers(option.Id); foreach (var answer in answers) { answerDAL.DeleteAnswer(answer); } optionChoiceDAL.DeleteOptionChoice(option); } questionDAL.DeleteQuestion(question); } } surveyDAL.DeleteSurvey(survey); }
public ActionResult Delete(int id, Question deleteQuestion, IFormCollection collection) { try { _questionRepo.DeleteQuestion(id); return(RedirectToAction(nameof(Index))); } catch (Exception ex) { _logger.LogError($"Failed to delete a question: {ex}"); return(View()); } }
public IActionResult DeleteQuiz(uint id) { List <Question> questions = new List <Question>(); questions = _question.GetQuestionsWithQuizId(id); for (int i = 0; i < questions.Count; i++) { _question.DeleteQuestion(questions[i].IdQuestion); } _quiz.DeteleQuiz(id); return(RedirectToAction("MyProfile")); }
public IHttpActionResult DELETE(int id) { _adapter.DeleteQuestion(id); return(Ok()); }
public static void DeleteQuestion(int Id) { dal.DeleteQuestion(Id.ToString()); }