using Bootstrap.Admin.Models;
using Bootstrap.DataAccess;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Bootstrap.Admin.Controllers
{
///
///
///
public class HomeController : Controller
{
///
///
///
///
public IActionResult Index()
{
var model = new HeaderBarModel(User.Identity);
var url = DictHelper.RetrieveHomeUrl(model.AppCode);
return url.Equals("~/Home/Index", System.StringComparison.OrdinalIgnoreCase) ? (IActionResult)View(model) : Redirect(url);
}
///
///
///
///
///
[AllowAnonymous]
public IActionResult Error(int id)
{
var model = ErrorModel.CreateById(id);
if (id != 403)
{
var returnUrl = Request.Query[CookieAuthenticationDefaults.ReturnUrlParameter].ToString();
if (!string.IsNullOrEmpty(returnUrl)) model.ReturnUrl = returnUrl;
}
return View(model);
}
}
}