Bearbeitung von Lektion und Kurs

This commit is contained in:
2020-06-09 16:00:08 +02:00
parent 6a49e1b8f7
commit 01585fc9ef
13 changed files with 317 additions and 72 deletions

View File

@@ -1,4 +1,4 @@
@model MultipleChoiceTrainer.Models.DataModels.Category
@model MultipleChoiceTrainer.Models.CategoryEditViewModel
@{
ViewData["Title"] = "Neuer Kurs";
@@ -10,14 +10,14 @@
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
<label asp-for="Entity.Name" class="control-label"></label>
<input asp-for="Entity.Name" class="form-control" />
<span asp-validation-for="Entity.Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
<label asp-for="Entity.Description" class="control-label"></label>
<input asp-for="Entity.Description" class="form-control" />
<span asp-validation-for="Entity.Description" class="text-danger"></span>
</div>
<div class="form-group">
<button type="submit" class="btn btn-outline-primary"><i class="fas fa-save"></i> Speichern</button>

View File

@@ -1,25 +1,25 @@
@model MultipleChoiceTrainer.Models.DataModels.Category
@model MultipleChoiceTrainer.Models.CategoryEditViewModel
@{
ViewData["Title"] = "Kurs bearbeiten";
}
<h4>Kurs bearbeiten</h4>
<h4>Kurs bearbeiten</h4>
<hr />
<div class="row">
<div class="col-12">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<input type="hidden" asp-for="Entity.Id" />
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
<label asp-for="Entity.Name" class="control-label"></label>
<input asp-for="Entity.Name" class="form-control" />
<span asp-validation-for="Entity.Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
<label asp-for="Entity.Description" class="control-label"></label>
<input asp-for="Entity.Description" class="form-control" />
<span asp-validation-for="Entity.Description" class="text-danger"></span>
</div>
<div class="form-group">
<button type="submit" class="btn btn-outline-primary"><i class="fas fa-save"></i> Speichern</button>

View File

@@ -1,20 +1,47 @@
@model IList<MultipleChoiceTrainer.Models.DataModels.Category>
<p class="text-right"><a href="@Url.Action("Create", "Categories")" class="btn btn-link"><i class="fal fa-plus"></i> Kurs hinzufügen</a></p>
<table class="table">
@foreach (var category in Model)
{
<tr class="table-primary">
<td>
<span class="badge badge-light"><a asp-action="edit" asp-controller="Categories" asp-route-id="@category.Id"><i class="far fa-file-edit"></i></a></span>
@category.Name<small class="text-muted"> @category.Description</small>
</td>
</tr>
@foreach (var sub in category.Sections)
{
<tr><td title="@sub.Description">@sub.Name</td></tr>
}
}
<tr class="table-primary"><td>Hundetrainer</td></tr>
<tr><td>Lektion 1 - Der Hund</td></tr>
<tr><td>Lektion 2 - Der Schwanz</td></tr>
</table>
@model MultipleChoiceTrainer.Models.HomeViewModel
<h2>Kursübersicht</h2>
<div class="row">
<div class="col-12 col-md-3">
<div class="nav flex-column nav-pills" id="v-pills-tab" role="tablist" aria-orientation="vertical">
@foreach (var category in Model.Categories)
{
<a class="nav-link @if(category.Id == Model.SelectedCategoryId) { <text>active</text>}" id="v-pills-@category.Id-tab" data-toggle="pill" href="#v-pills-@category.Id" role="tab" aria-controls="v-pills-@category.Id" @if (category.Id == Model.SelectedCategoryId) { <text> aria-selected="true" </text> }>@category.Name</a>
}
<a href="@Url.Action("Create", "Categories")" class="nav-link"><i class="fal fa-plus"></i> Kurs hinzufügen</a>
</div>
</div>
<div class="col-9">
<div class="tab-content" id="v-pills-tabContent">
@foreach (var category in Model.Categories)
{
<div class="tab-pane fade @if(category.Id == Model.SelectedCategoryId) { <text>show active</text>}" id="v-pills-@category.Id" role="tabpanel" aria-labelledby="v-pills-@category.Id-tab">
<h3>@category.Name <small class="text-muted">@category.Description</small></h3>
<p class="text-black-50">
<a asp-action="edit" asp-controller="Categories" asp-route-id="@category.Id" class="text-black-50"><i class="far fa-edit"></i> Kurs bearbeiten</a> &nbsp;&nbsp;&nbsp;
<a asp-action="create" asp-controller="Sections" asp-route-categoryId="@category.Id" class="text-black-50"><i class="far fa-plus"></i> Lektion hinzufügen</a> &nbsp;&nbsp;&nbsp;
<a asp-action="create" asp-controller="Sections" asp-route-categoryId="@category.Id" class="text-black-50"><i class="far fa-map-marker-question"></i> Quiz starten</a>
</p>
<div class="list-group">
@foreach (var sub in category.Sections)
{
<ul class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">@sub.Name <small class="text-muted">@sub.Description</small></h5>
<small>@sub.Questions.Count() Fragen</small>
</div>
<p class="text-black-50">
<a asp-action="edit" asp-controller="Sections" asp-route-id="@sub.Id" class="text-black-50"><i class="far fa-edit"></i> Lektion bearbeiten</a> &nbsp;&nbsp;&nbsp;
<a asp-action="create" asp-controller="Sections" asp-route-categoryId="@category.Id" class="text-black-50"><i class="far fa-plus"></i> Frage hinzufügen</a> &nbsp;&nbsp;&nbsp;
<a asp-action="create" asp-controller="Sections" asp-route-categoryId="@category.Id" class="text-black-50"><i class="far fa-map-marker-question"></i> Quiz starten</a>
</p>
</ul>
}
</div>
</div>
}
</div>
</div>
</div>

View File

@@ -0,0 +1,37 @@
@model MultipleChoiceTrainer.Models.DataModels.Section
@{
ViewData["Title"] = "Lektion anlegen";
}
<h4>Lektion anlegen</h4>
<hr />
<div class="row">
<div class="col-md-12">
<form asp-action="Create">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Category" class="control-label"></label>
<select asp-for="CategoryId" class="form-control" asp-items="ViewBag.CategoryId"></select>
</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" class="btn btn-outline-danger"><i class="fas fa-times"></i> Abbrechen</a>
</div>
</form>
</div>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}

View File

@@ -0,0 +1,39 @@
@model MultipleChoiceTrainer.Models.DataModels.Section
@{
ViewData["Title"] = "Lektion bearbeiten";
}
<h4>Lektion bearbeiten</h4>
<hr />
<div class="row">
<div class="col-md-12">
<form asp-action="Edit">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<input type="hidden" asp-for="Id" />
<div class="form-group">
<label asp-for="Name" class="control-label"></label>
<input asp-for="Name" class="form-control" />
<span asp-validation-for="Name" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Description" class="control-label"></label>
<input asp-for="Description" class="form-control" />
<span asp-validation-for="Description" class="text-danger"></span>
</div>
<div class="form-group">
<label asp-for="Category" class="control-label"></label>
<select asp-for="CategoryId" class="form-control" asp-items="ViewBag.CategoryId"></select>
<span asp-validation-for="CategoryId" class="text-danger"></span>
</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" class="btn btn-outline-danger"><i class="fas fa-times"></i> Abbrechen</a>
</div>
</form>
</div>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}