Exemplo n.º 1
0
        public List <EnumProfileClaims> GetPersonProfile(int userId)
        {
            var _context   = _contextFactory();
            var userPerson = (from u in _context.User
                              join p in _context.Person on u.PersonId equals p.PersonId
                              where u.UserId.Equals(userId) &&
                              u.Active && (u.UserStatusId == (byte)GeneralEnumerators.EnumUserStatus.Ativo)
                              select new { u.UserProfileId, p.PersonRules }).ToList();



            if (userPerson.Count == 0)
            {
                return(null);
            }

            var auth = userPerson.Select(x => new Authentication
            {
                PersonRules   = x.PersonRules,
                UserProfileId = x.UserProfileId
            }).ToList();

            var ret = new List <EnumProfileClaims>();

            auth.ForEach(x => ret = CustomProfile.ListProfilesClaims(x.UserProfileId, x.PersonRules.Select(y => y.PersonProfileId).ToList()));
            return(ret);
        }