Bilder zur Frage können hochgeladen werden;
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@model MultipleChoiceTrainer.Models.DataModels.Question
|
||||
@model MultipleChoiceTrainer.Models.QuestionViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Frage Anlegen";
|
||||
@@ -9,7 +9,7 @@
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form asp-action="Create">
|
||||
<form asp-action="Create" enctype="multipart/form-data">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="SectionId" value="@ViewBag.Section.Id" />
|
||||
<div class="form-group row">
|
||||
@@ -17,31 +17,37 @@
|
||||
<input asp-for="Text" class="form-control col-10" />
|
||||
<span asp-validation-for="Text" class="text-danger offset-2"></span>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file col-10 offset-2">
|
||||
<input class="custom-file-input" asp-for="QuestionImage">
|
||||
<label class="custom-file-label" asp-for="QuestionImage"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label asp-for="Choices" class="control-label col-2"></label>
|
||||
<div class="col-10 row">
|
||||
@for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
{
|
||||
<input asp-for="@Model.Choices[i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input asp-for="@Model.Choices[i].IsTrue" class="form-check-input" value="true" />
|
||||
<label asp-for="@Model.Choices[i].IsTrue" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" name="Choices[@i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input type="checkbox" name="Choices[@i].IsTrue" id="CheckBox-IsTrue-@i" class="form-check-input" value="true" />
|
||||
<label for="CheckBox-IsTrue-@i" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
{
|
||||
<input asp-for="@Model.Choices[i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input asp-for="@Model.Choices[i].IsTrue" class="form-check-input" value="true" />
|
||||
<label asp-for="@Model.Choices[i].IsTrue" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" name="Choices[@i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input type="checkbox" name="Choices[@i].IsTrue" id="CheckBox-IsTrue-@i" class="form-check-input" value="true" />
|
||||
<label for="CheckBox-IsTrue-@i" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<span asp-validation-for="Choices" class="text-danger" ></span>
|
||||
<span asp-validation-for="Choices" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
@model MultipleChoiceTrainer.Models.DataModels.Question
|
||||
@model MultipleChoiceTrainer.Models.QuestionViewModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Frage bearbeiten";
|
||||
@@ -9,7 +9,7 @@
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<form asp-action="Edit">
|
||||
<form asp-action="Edit" enctype="multipart/form-data">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="Id" />
|
||||
<input type="hidden" asp-for="SectionId" />
|
||||
@@ -19,32 +19,39 @@
|
||||
<input asp-for="Text" class="form-control col-10" />
|
||||
<span asp-validation-for="Text" class="text-danger offset-2"></span>
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<div class="custom-file col-10 offset-2">
|
||||
<input class="custom-file-input" asp-for="QuestionImage">
|
||||
<label class="custom-file-label" asp-for="QuestionImage"></label>
|
||||
</div>
|
||||
<input type="hidden" asp-for="Image" />
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label asp-for="Choices" class="control-label col-2"></label>
|
||||
<div class="col-10 row">
|
||||
@for (int i = 0; i < 5; i++)
|
||||
{
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
{
|
||||
<input asp-for="@Model.Choices[i].Id" type="hidden" />
|
||||
<input asp-for="@Model.Choices[i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input asp-for="@Model.Choices[i].IsTrue" class="form-check-input" value="true" />
|
||||
<label asp-for="@Model.Choices[i].IsTrue" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" name="Choices[@i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input type="checkbox" name="Choices[@i].IsTrue" id="CheckBox-IsTrue-@i" class="form-check-input" value="true" />
|
||||
<label for="CheckBox-IsTrue-@i" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
{
|
||||
<input asp-for="@Model.Choices[i].Id" type="hidden" />
|
||||
<input asp-for="@Model.Choices[i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input asp-for="@Model.Choices[i].IsTrue" class="form-check-input" value="true" />
|
||||
<label asp-for="@Model.Choices[i].IsTrue" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="text" name="Choices[@i].Text" class="form-control col-10" />
|
||||
<div class="form-check col-2 text-right">
|
||||
<input type="checkbox" name="Choices[@i].IsTrue" id="CheckBox-IsTrue-@i" class="form-check-input" value="true" />
|
||||
<label for="CheckBox-IsTrue-@i" class="form-check-label">Richtig</label>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
<span asp-validation-for="Choices" class="text-danger" ></span>
|
||||
<span asp-validation-for="Choices" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -41,10 +41,15 @@
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
<script src="~/js/bs-custom-file-input.min.js"></script>
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip()
|
||||
})
|
||||
|
||||
$(document).ready(function () {
|
||||
bsCustomFileInput.init()
|
||||
})
|
||||
</script>
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user