public virtual ActionResult Delete(DeleteConfirmViewModel model) { var questionnaireId = _questionsRepository.GetById(model.Id).QuestionnaireId; _questionsRepository.Delete(model.Id); return(RedirectToAction(MVC.Admin.Questions.List(questionnaireId))); }
public async Task <bool> Delete(int questionId) { if (questionId == default || questionId <= 0) { throw new QuestionException(QUESTION_IS_INVALID); } return(await _questionsRepository.Delete(questionId)); }
protected override Result Handle(DeleteQuestionCommand request) { EnsureArg.IsNotNull(request); var questionOrNothing = questionRepository.GetById(request.QuestionId); return(questionOrNothing.ToResult("Question not found") .OnSuccess(x => questionRepository.Delete(x)) .OnSuccess(_ => questionRepository.SaveChanges())); }
public async Task <IActionResult> Delete(int?id) { if (id == null) { return(View("QuestionNotFound")); } var question = await questionsRepository.Get(id); if (question == null) { return(View("QuestionNotFound")); } await questionsRepository.Delete(id); await optionsRepository.DeleteByQuestionId(id); await userAnswersRepository.Delete(id); return(RedirectToAction("Index")); }
public void Delete(int id) { var existingQuestion = _questionsRepository.Get(id); _questionsRepository.Delete(existingQuestion); }
public void Delete(Questions entity) { _questions.Delete(entity); }