public async Task <ActionResult> Delete(Guid id, IFormCollection collection)
        {
            try
            {
                if (id == null)
                {
                    throw new Exception("Bad Delete Request.");
                }
                Answers antwoord = await answerRepo.GetAnswerByAnswerID(id);

                Questions question = await quizrepo.GetQuizByQuestionID(antwoord.QuestionId);

                await answerRepo.Delete(id);

                return(RedirectToAction("Index", "QuestionsAnswers", new { id = question.QuizID }));
            }
            catch (Exception)
            {
                Debug.WriteLine($"Delete error. ");
                ModelState.AddModelError(String.Empty, "Delete failed.");
                return(View());
            }
        }
        public async Task <IActionResult> Delete(int id)
        {
            await _repo.Delete(id);

            return(Content("success"));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete(Guid id)
        {
            await answerrepo.Delete(id);

            return(Ok("DELETE was succesfull"));
        }