Ejemplo n.º 1
0
        protected async Task <CorporateUserModel> GetLoggedinUser()
        {
            if (User.Identity.IsAuthenticated)
            {
                var identity = (System.Security.Claims.ClaimsIdentity)User.Identity;
                var email    = identity.Claims.Where(w => w.Type == System.Security.Claims.ClaimTypes.Email).Select(s => s.Value)?.FirstOrDefault()?.ToString();
                var user     = await _corporateUserQuery.GetByEmail(email);

                return(user);
            }
            return(null);
        }
        public async Task <IViewComponentResult> InvokeAsync()
        {
            if (User.Identity.IsAuthenticated)
            {
                var identity            = (System.Security.Claims.ClaimsIdentity)User.Identity;
                var email               = identity.Claims.Where(w => w.Type == System.Security.Claims.ClaimTypes.Email).Select(s => s.Value)?.FirstOrDefault()?.ToString();
                CorporateUserModel user = await _corporateUserQuery.GetByEmail(email);

                return(View("/Areas/Corporate/Views/Shared/Components/CorporateHeader/CorporateHeader.cshtml", user));
            }
            return(View("/Areas/Corporate/Views/Shared/Components/CorporateHeader/CorporateHeader.cshtml"));
        }