public virtual ActionResult Delete(DeleteConfirmViewModel model)
        {
            var questionnaireId = _questionsRepository.GetById(model.Id).QuestionnaireId;

            _questionsRepository.Delete(model.Id);

            return(RedirectToAction(MVC.Admin.Questions.List(questionnaireId)));
        }
Exemplo n.º 2
0
        public async Task <bool> Delete(int questionId)
        {
            if (questionId == default || questionId <= 0)
            {
                throw new QuestionException(QUESTION_IS_INVALID);
            }

            return(await _questionsRepository.Delete(questionId));
        }
Exemplo n.º 3
0
        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()));
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        public void Delete(int id)
        {
            var existingQuestion = _questionsRepository.Get(id);

            _questionsRepository.Delete(existingQuestion);
        }
Exemplo n.º 6
0
 public void Delete(Questions entity)
 {
     _questions.Delete(entity);
 }