Anzeige von Bild im Quiz und bei auswertung;
This commit is contained in:
@@ -81,6 +81,8 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
var refQuestion = _context.Questions.Include(e => e.Choices).First(q => q.Id == viewModel.CurrentQuestion.Id);
|
||||
newViewModel.Evaluations = new List<Evaluation>();
|
||||
newViewModel.PreviousQuestion = refQuestion.Text;
|
||||
newViewModel.PreviousQuestionImage = refQuestion.Image;
|
||||
|
||||
foreach(var answer in viewModel.Choices)
|
||||
{
|
||||
var refChoice = refQuestion.Choices.First(rc => rc.Id == answer.Id);
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace MultipleChoiceTrainer.Models
|
||||
public bool HasPreviousResult => (Evaluations != null && Evaluations.Any());
|
||||
public bool PassedPreviousQuestion => HasPreviousResult && !Evaluations.Any(e => !e.Success);
|
||||
public string PreviousQuestion { get; set; }
|
||||
public string PreviousQuestionImage { get; set; }
|
||||
public IList<Evaluation> Evaluations { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
<div class="alert alert-@(Model.PassedPreviousQuestion ? "success" : "danger" )" role="alert">
|
||||
<h4 class="alert-heading">@(Model.PassedPreviousQuestion ? "Gut gemacht!" : "Leider falsch!" )</h4>
|
||||
<p class="lead">@Model.PreviousQuestion</p>
|
||||
@if (!string.IsNullOrEmpty(Model.PreviousQuestionImage))
|
||||
{
|
||||
<img src="~/uploads/images/questions/@Model.PreviousQuestionImage" style="max-width: 250px; max-height: 250px;" class="mb-1" />
|
||||
}
|
||||
<table class="table table-borderless table-striped table-sm table-dark border border-dark">
|
||||
<tr>
|
||||
<th>Frage</th>
|
||||
<th>Antwort</th>
|
||||
<th>Soll</th>
|
||||
<th>Ist</th>
|
||||
</tr>
|
||||
@@ -39,6 +43,10 @@
|
||||
<p class="lead">
|
||||
@Model.CurrentQuestion.Text <small class="text-black-50"> <i class="fas fa-info-circle" data-toggle="tooltip" title="(@Model.CurrentQuestion.Choices.Count(e => e.IsTrue) von @Model.Choices.Count())"></i></small>
|
||||
</p>
|
||||
@if(!string.IsNullOrEmpty(Model.CurrentQuestion.Image))
|
||||
{
|
||||
<img src="~/uploads/images/questions/@Model.CurrentQuestion.Image" class="img-fluid" style="max-height: 400px;" />
|
||||
}
|
||||
@for (int i = 0; i < Model.Choices.Count(); i++)
|
||||
{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user