BaseController.cs 756 B

1234567891011121314151617181920212223
  1. using Microsoft.AspNetCore.Mvc;
  2. using ProductionLineMonitor.Core.Dtos;
  3. using ProductionLineMonitor.Core.Utils;
  4. using ProductionLineMonitor.Web.Filters;
  5. using System.Linq;
  6. using System.Security.Claims;
  7. namespace ProductionLineMonitor.Web.Controllers
  8. {
  9. [AuthenFilter]
  10. [GlobalModelValidate]
  11. [TypeFilter(typeof(GlobalExceptionAttribute))]
  12. public class BaseController : Controller
  13. {
  14. protected UserLoginResultInfoDto _userLoginInfo;
  15. public override ViewResult View()
  16. {
  17. string value = HttpContext.User.Claims.FirstOrDefault(x => x.Type == ClaimTypes.UserData).Value;
  18. _userLoginInfo = value.ToObject<UserLoginResultInfoDto>();
  19. return base.View(_userLoginInfo);
  20. }
  21. }
  22. }