コード例 #1
0
        public async Task <IActionResult> DeleteResult(Guid id, IFormCollection collection, Guid QuizId, string quizName)
        {
            try
            {
                await quizRepo.DeleteResult(id);

                var obj = await quizRepo.GetQuizForIdAsync(QuizId);

                if (obj == null || QuizId == Guid.Empty)
                {
                    return(RedirectToAction(nameof(Quizzes), new { exc = "Wrong QuizId" }));
                }
                return(RedirectToAction(nameof(QuizResults), new { QuizId = QuizId, quizName = quizName }));
            }
            catch (Exception exc)
            {
                return(RedirectToAction(nameof(Quizzes), new { exc = exc.Message }));
            }
        }