2021-11-15 07:44:18 +00:00
|
|
|
using EFB.Models;
|
|
|
|
using EFB.Sessions;
|
2022-02-28 21:53:28 +00:00
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2021-11-15 07:44:18 +00:00
|
|
|
|
|
|
|
namespace EFB.Controllers
|
|
|
|
{
|
|
|
|
public class AppController : Controller
|
|
|
|
{
|
|
|
|
private readonly ILogger<AppController> _logger;
|
|
|
|
|
|
|
|
public AppController(ILogger<AppController> logger)
|
|
|
|
{
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
|
|
|
public IActionResult Index()
|
|
|
|
{
|
|
|
|
//Check to see what point on the application the user is at and where they should be sent
|
2022-02-18 22:43:01 +00:00
|
|
|
UserModel user = HttpContext.Session.GetObject<UserModel>("User");
|
|
|
|
if (user == null)
|
2021-11-15 07:44:18 +00:00
|
|
|
{
|
2022-02-28 21:53:28 +00:00
|
|
|
return RedirectToAction("Index", "Home");
|
2021-11-15 07:44:18 +00:00
|
|
|
}
|
2022-02-18 22:43:01 +00:00
|
|
|
if (user.Route == null)
|
|
|
|
{
|
|
|
|
return RedirectToAction("Index", "Route");
|
|
|
|
}
|
2022-02-28 21:53:28 +00:00
|
|
|
|
2022-02-18 22:43:01 +00:00
|
|
|
return View(user);
|
2021-11-15 07:44:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
|
|
|
public IActionResult Error()
|
|
|
|
{
|
|
|
|
return View("Error!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|