Antwortmöglichkeiten auf 10 erhöht;
This commit is contained in:
@@ -17,6 +17,9 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
|
||||
public const int CountChoiceFields = 10;
|
||||
|
||||
public QuestionsController(ApplicationDbContext context, IWebHostEnvironment hostEnvironment)
|
||||
{
|
||||
_context = context;
|
||||
@@ -33,6 +36,7 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
public IActionResult Create(int sectionId)
|
||||
{
|
||||
ViewData["Section"] = _context.Sections.Include(e => e.Category).FirstOrDefault(s => s.Id == sectionId);
|
||||
ViewData["CountChoiceFields"] = CountChoiceFields;
|
||||
return View();
|
||||
}
|
||||
|
||||
@@ -55,6 +59,7 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
return RedirectToAction(nameof(Index), "Home", new { categoryId = section.CategoryId });
|
||||
}
|
||||
ViewData["Section"] = _context.Sections.Include(e => e.Category).FirstOrDefault(s => s.Id == question.SectionId);
|
||||
ViewData["CountChoiceFields"] = CountChoiceFields;
|
||||
return View(question);
|
||||
}
|
||||
|
||||
@@ -71,6 +76,8 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
ViewData["CountChoiceFields"] = CountChoiceFields;
|
||||
ViewData["Section"] = _context.Sections.Include(e => e.Category).FirstOrDefault(s => s.Id == question.SectionId);
|
||||
|
||||
var vm = new QuestionViewModel()
|
||||
@@ -128,6 +135,7 @@ namespace MultipleChoiceTrainer.Controllers
|
||||
}
|
||||
return RedirectToAction(nameof(List), new { sectionId = question.SectionId });
|
||||
}
|
||||
ViewData["CountChoiceFields"] = CountChoiceFields;
|
||||
ViewData["Section"] = _context.Sections.Include(e => e.Category).FirstOrDefault(s => s.Id == question.SectionId);
|
||||
return View(question);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<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++)
|
||||
@for (int i = 0; i < ViewBag.CountChoiceFields; i++)
|
||||
{
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<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++)
|
||||
@for (int i = 0; i < ViewBag.CountChoiceFields; i++)
|
||||
{
|
||||
<div class="row col-12 mb-1 px-0 mx-0">
|
||||
@if (Model != null && Model.Choices != null && Model.Choices.Count > i)
|
||||
|
||||
Reference in New Issue
Block a user