main
| Line | |
|---|
| 1 | using Microsoft.AspNetCore.Mvc;
|
|---|
| 2 | using Microsoft.AspNetCore.Mvc.Filters;
|
|---|
| 3 |
|
|---|
| 4 | namespace StockMaster.Controllers
|
|---|
| 5 | {
|
|---|
| 6 | public class BaseController : Controller
|
|---|
| 7 | {
|
|---|
| 8 | public override void OnActionExecuting(ActionExecutingContext context)
|
|---|
| 9 | {
|
|---|
| 10 | var userId = context.HttpContext.Session.GetInt32("UserId");
|
|---|
| 11 | if (!userId.HasValue)
|
|---|
| 12 | {
|
|---|
| 13 | context.Result = new RedirectToActionResult("Login", "Account", null);
|
|---|
| 14 | }
|
|---|
| 15 | base.OnActionExecuting(context);
|
|---|
| 16 | }
|
|---|
| 17 | }
|
|---|
| 18 | } |
|---|
Note:
See
TracBrowser
for help on using the repository browser.