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);
|
var refQuestion = _context.Questions.Include(e => e.Choices).First(q => q.Id == viewModel.CurrentQuestion.Id);
|
||||||
newViewModel.Evaluations = new List<Evaluation>();
|
newViewModel.Evaluations = new List<Evaluation>();
|
||||||
newViewModel.PreviousQuestion = refQuestion.Text;
|
newViewModel.PreviousQuestion = refQuestion.Text;
|
||||||
|
newViewModel.PreviousQuestionImage = refQuestion.Image;
|
||||||
|
|
||||||
foreach(var answer in viewModel.Choices)
|
foreach(var answer in viewModel.Choices)
|
||||||
{
|
{
|
||||||
var refChoice = refQuestion.Choices.First(rc => rc.Id == answer.Id);
|
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 HasPreviousResult => (Evaluations != null && Evaluations.Any());
|
||||||
public bool PassedPreviousQuestion => HasPreviousResult && !Evaluations.Any(e => !e.Success);
|
public bool PassedPreviousQuestion => HasPreviousResult && !Evaluations.Any(e => !e.Success);
|
||||||
public string PreviousQuestion { get; set; }
|
public string PreviousQuestion { get; set; }
|
||||||
|
public string PreviousQuestionImage { get; set; }
|
||||||
public IList<Evaluation> Evaluations { get; set; }
|
public IList<Evaluation> Evaluations { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,16 @@
|
|||||||
|
|
||||||
@if (Model.HasPreviousResult)
|
@if (Model.HasPreviousResult)
|
||||||
{
|
{
|
||||||
<div class="alert alert-@(Model.PassedPreviousQuestion ? "success" : "danger" )" role="alert">
|
<div class="alert alert-@(Model.PassedPreviousQuestion ? "success" : "danger" )" role="alert">
|
||||||
<h4 class="alert-heading">@(Model.PassedPreviousQuestion ? "Gut gemacht!" : "Leider falsch!" )</h4>
|
<h4 class="alert-heading">@(Model.PassedPreviousQuestion ? "Gut gemacht!" : "Leider falsch!" )</h4>
|
||||||
<p class="lead">@Model.PreviousQuestion</p>
|
<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">
|
<table class="table table-borderless table-striped table-sm table-dark border border-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Frage</th>
|
<th>Antwort</th>
|
||||||
<th>Soll</th>
|
<th>Soll</th>
|
||||||
<th>Ist</th>
|
<th>Ist</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -30,7 +34,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
<h4>Frage beantworten</h4>
|
<h4>Frage beantworten</h4>
|
||||||
@@ -39,6 +43,10 @@
|
|||||||
<p class="lead">
|
<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>
|
@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>
|
</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++)
|
@for (int i = 0; i < Model.Choices.Count(); i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user