public async Task <IActionResult> EditAnswer(Guid id, Guid QuizId, string FotoURL) { try { Answer answer = await quizRepo.GetAnswerForIdAsync(id); if (answer == null || id == Guid.Empty) { return(RedirectToAction(nameof(Quizzes), new { exc = "Wrong AnswerId" })); } AnswerEditViewModel answerEdit = new AnswerEditViewModel { Id = answer.Id, Description = answer.Description, FotoURL = answer.FotoURL, QuestionId = answer.QuestionId }; Question question = await quizRepo.GetQuestionForIdAsync(answer.QuestionId); Quiz quiz = await quizRepo.GetQuizForIdAsync(QuizId); if (quiz == null || QuizId == Guid.Empty) { return(RedirectToAction(nameof(Quizzes), new { exc = "Wrong QuizId" })); } ViewData["QuestionName"] = question.Description; ViewData["QuestionId"] = answer.QuestionId; ViewData["FotoURL"] = FotoURL; ViewData["IsCorrect"] = answer.Correct; ViewData["QuizId"] = QuizId; return(View(answerEdit)); } catch (Exception exc) { return(RedirectToAction(nameof(Quizzes), new { exc = exc.Message })); } }