Erste Version der Fragen-Eingabe
This commit is contained in:
57
MultipleChoiceTrainer/Views/Questions/Create.cshtml
Normal file
57
MultipleChoiceTrainer/Views/Questions/Create.cshtml
Normal file
@@ -0,0 +1,57 @@
|
||||
@model MultipleChoiceTrainer.Models.DataModels.Question
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Frage Anlegen";
|
||||
}
|
||||
|
||||
<h4>Frage anlegen</h4>
|
||||
<p class="text-black-50">in Lektion <i>@ViewBag.Section.Name</i>, Kurs <i>@ViewBag.Section.Category.Name</i></p>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form asp-action="Create">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="SectionId" value="@ViewBag.Section.Id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="Text" class="control-label"></label>
|
||||
<input asp-for="Text" class="form-control" />
|
||||
<span asp-validation-for="Text" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Choices" class="control-label"></label>
|
||||
@if (Model != null && Model.Choices != null)
|
||||
{
|
||||
@for (int i = 0; i < Model.Choices.Count; i++)
|
||||
{
|
||||
<div class="text-center">
|
||||
<input asp-for="@Model.Choices[i].Text" class="form-control" />
|
||||
<input asp-for="@Model.Choices[i].IsTrue" class="form-control" />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="hidden" name="Choices.Index" value="10" />
|
||||
<input type="text" name="Choices[10].Text" class="form-control" />
|
||||
<input type="checkbox" name="Choices[10].IsTrue" class="form-control" value="true" />
|
||||
|
||||
<input type="hidden" name="Choices.Index" value="11" />
|
||||
<input type="text" name="Choices[11].Text" class="form-control" />
|
||||
<input type="checkbox" name="Choices[11].IsTrue" class="form-control" value="true" />
|
||||
}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-outline-primary"><i class="fas fa-save"></i> Speichern</button>
|
||||
<a asp-action="Index" asp-controller="Home" asp-route-categoryId="@ViewBag.Section.CategoryId" class="btn btn-outline-danger"><i class="fas fa-times"></i> Abbrechen</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
|
||||
}
|
||||
Reference in New Issue
Block a user