public void OnAuthorization(AuthorizationFilterContext context) { var customerID = CustomerSessionKey.GetCustomerID(context.HttpContext.Session); if (!customerID.HasValue) { context.Result = new RedirectToActionResult("Index", "Home", null); } }
public IActionResult Index() { int?customerIdNullable = CustomerSessionKey.GetCustomerID(HttpContext.Session); if (customerIdNullable == null) { return(RedirectToAction("Index", "Login")); } return(RedirectToAction("Index", "Customer")); }