public UserInfoViewModel GetUserInfo() { ExternalLoginData externalLogin = ExternalLoginData.FromIdentity(User.Identity as ClaimsIdentity); var _menuServices = new MP.Core.BUS.MNG.MenuServices(); var identity = (ClaimsPrincipal)Thread.CurrentPrincipal; return(new UserInfoViewModel { UserID = User.Identity.GetUserId(), UserName = User.Identity.GetUserName(), Department = identity.Claims.Where(c => c.Type == "Department").Select(x => x.Value).SingleOrDefault(), Email = identity.Claims.Where(c => c.Type == "Email").Select(x => x.Value).SingleOrDefault(), PhoneNumber = identity.Claims.Where(c => c.Type == "PhoneNumber").Select(x => x.Value).SingleOrDefault(), FullName = identity.Claims.Where(c => c.Type == "FullName").Select(x => x.Value).SingleOrDefault(), Menus = _menuServices.GetMenuByUserId(this.RequestContext.Principal.Identity.GetUserId()), VOCRoles = identity.Claims.Where(c => c.Type == "VOCRoles").Select(x => x.Value).SingleOrDefault(), HasRegistered = externalLogin == null, LoginProvider = externalLogin != null ? externalLogin.LoginProvider : null }); }
public object GetMenuByUserId() { var _menuServices = new MP.Core.BUS.MNG.MenuServices(); return(new { value = _menuServices.GetMenuByUserId(this.RequestContext.Principal.Identity.GetUserId()) }); }