Inheritance: BaseEntity
Example #1
0
 public static FeatureModel Convert(Feature feature)
 {
     return new FeatureModel()
     {
         Id = feature.Id,
         FeatureName = feature.Name,
         Description = feature.Description,
         Children = feature.Children.Select(c => FeatureModel.Convert(c)).ToList<FeatureModel>()
     };
 }
Example #2
0
        public static FeaturePermissionGridRowModel Convert(Subject subject, Feature feature, int featurePermissionType, bool effectiveRight)
        {
            return new FeaturePermissionGridRowModel()
            {
                FeatureId = feature.Id,

                SubjectId = subject.Id,
                SubjectName = subject.Name,
                SubjectType = subject is User ? "User" : "Group",

                EffectiveRight = effectiveRight,
                FeaturePermissionType = featurePermissionType
            };
        }
Example #3
0
        public static FeaturePermissionModel Convert(Feature feature, Subject subject, bool existsPermission, bool effectiveRight)
        {
            return new FeaturePermissionModel()
            {
                FeatureId = feature.Id,
                FeatureName = feature.Name,
                FeatureDescription = feature.Description,

                SubjectId = subject.Id,
                SubjectName = subject.Name,
                SubjectType = subject is User ? "User" : "Role",

                ExistsPermission = existsPermission,
                EffectiveRight = effectiveRight
            };
        }
Example #4
0
        public static FeatureTreeViewModel Convert(Feature feature, IsFeatureInEveryoneGroupDelegate isFeatureInEveryoneGroupDelegate)
        {
            return new FeatureTreeViewModel()
            {
                Id = feature.Id,
                FeatureName = feature.Name,
                Description = feature.Description,

                IsFeatureInEveryoneGroup = isFeatureInEveryoneGroupDelegate(feature.Id),

                Children = feature.Children.Select(c => FeatureTreeViewModel.Convert(c, isFeatureInEveryoneGroupDelegate)).ToList<FeatureTreeViewModel>()
            };
        }