コード例 #1
0
        public IActionResult DeleteQuestion(int id)
        {
            var repo = new QuestionRepo();

            repo.DeleteQuestion(id);
            return(RedirectToAction("ListAll"));
        }
コード例 #2
0
        public async Task <IActionResult> Delete(int id)
        {
            var success = await QuestionRepo.DeleteQuestion(id);

            if (!success)
            {
                return(NotFound());
            }
            return(NoContent());
        }
コード例 #3
0
        public Tuple <Quiz, List <Questions> > DeleteQuizQuestions(string QuizId, string QuestionId)
        {
            QuestionRepo repo       = new QuestionRepo();
            int          QuizID     = 0;
            int          QuestionID = 0;

            int.TryParse(QuizId, out QuizID);
            int.TryParse(QuestionId, out QuestionID);
            bool result = repo.DeleteQuestion(QuizID, QuestionID);

            if (result)
            {
                return(repo.LoadAllQuizQuestions(QuizID));
            }
            else
            {
                return(null);
            }
        }