Пример #1
0
        public List <RoleDto> GetGroupRoles(int groupId)
        {
            AppDomainTDataAccess appDomainDa = new AppDomainTDataAccess();
            List <RoleDto>       roleList    = new List <RoleDto>();
            var roles = this.Repository.Context.RoleToGroups.Where(it => it.GroupId == groupId).Select(it => it.Role).ToList();

            foreach (var role in roles)
            {
                var appDomain = appDomainDa.GetSingle(it => it.ApplicationDomainId == role.AppDomainId);
                var roleDto   = RoleRepository.GetDto(role);
                roleDto.ApplicationDomainDto = appDomain;
                roleList.Add(roleDto);
            }
            return(roleList);
        }
Пример #2
0
        public List <SecurityGroupDto> GetRoleGroups(RoleDto role)
        {
            AppDomainTDataAccess appDomainDa = new AppDomainTDataAccess();
            var groups  = this.Repository.Context.RoleToGroups.Where(it => it.RoleId == role.RoleId).Select(it => it.Securitygroup);
            var dtoList = SecurityGroupRepository.GetDtos(groups);

            foreach (var dto in dtoList)
            {
                var appDomain = appDomainDa.GetSingle(it => it.ApplicationDomainId == dto.AppDomainId);
                if (appDomain != null)
                {
                    dto.ApplicationDomainDto = appDomain;
                }
            }
            return(dtoList.ToList());
        }