EFB/Controllers/AppController.cs

45 lines
1.2 KiB
C#
Raw Normal View History

2021-11-15 07:44:18 +00:00
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using EFB.Models;
using Microsoft.AspNetCore.Http;
using EFB.Sessions;
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-18 22:43:01 +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");
}
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!");
}
}
}