Font-Awesome und Startseite;

This commit is contained in:
2020-06-04 22:45:42 +02:00
parent 30d2822891
commit cb5acd12eb
7925 changed files with 111573 additions and 37 deletions

View File

@@ -3,8 +3,11 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using MultipleChoiceTrainer.Data;
using MultipleChoiceTrainer.Models;
namespace MultipleChoiceTrainer.Controllers
@@ -12,25 +15,30 @@ namespace MultipleChoiceTrainer.Controllers
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
private readonly SignInManager<IdentityUser> signInManager;
private readonly ApplicationDbContext context;
public HomeController(ILogger<HomeController> logger)
public HomeController(ILogger<HomeController> logger, SignInManager<IdentityUser> signInManager, ApplicationDbContext context)
{
_logger = logger;
this.signInManager = signInManager;
this.context = context;
}
public IActionResult Index()
{
return View();
}
public IActionResult Privacy()
{
if (signInManager.IsSignedIn(User))
{
var categories = context.Categories.Include(e => e.Sections).ThenInclude(e => e.Questions).ToList();
return View(categories);
}
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
_logger.Log(LogLevel.Error, "Es ist ein Fehler aufgetreten");
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}