public void SaveRoleFeatures(RoleFeaturesModel roleFeatures) { AddRoleFeaturesRequest addRoleFeaturesRequest = new AddRoleFeaturesRequest(); addRoleFeaturesRequest.RoleId = roleFeatures.RoleId; addRoleFeaturesRequest.Features = new List<ModuleFeatureDC>(); foreach (ModuleModel module in roleFeatures.Features) { foreach (ModuleFeatureModel feature in module.ModuleFeatures) { if (feature.IsSelected) { ModuleFeatureDC featureDC = new ModuleFeatureDC(); featureDC.FeatureId = feature.FeatureId; featureDC.RoleFeaturePermissions = new List<FeaturePermissionDC>(); foreach (FeaturePermissionModel permission in feature.RoleFeaturePermissions) { if (permission.IsAssigned) { featureDC.RoleFeaturePermissions.Add(new FeaturePermissionDC { FeatureId = feature.FeatureId, ContentPermissionId = permission.ContentPermissionId }); } } addRoleFeaturesRequest.Features.Add(featureDC); } } } ServiceResponse addRoleFeaturesResponse = _securityProxy.Execute(opt => opt.SaveRoleFeatures(addRoleFeaturesRequest)); if (addRoleFeaturesResponse.Status != ResponseStatus.Success) HandleError(addRoleFeaturesResponse.Status, addRoleFeaturesResponse.ResponseMessage); }
/// <summary> /// SaveSiteFeaturesSettings /// </summary> /// <param name="siteFeaturesModel"></param> public void SaveSiteFeaturesSettings(SiteFeaturesModel siteFeaturesModel) { List<ModuleFeatureDC> serviceRequest = new List<ModuleFeatureDC>(); foreach (ModuleModel module in siteFeaturesModel.Features) { foreach (ModuleFeatureModel feature in module.ModuleFeatures) { if (feature.SiteContentSettings.Count > 0) { ModuleFeatureDC featureDC = new ModuleFeatureDC(); featureDC.FeatureId = feature.FeatureId; featureDC.SiteContentSettings = new List<SiteContentSettingDC>(); foreach (SiteContentSettingModel contentSetting in feature.SiteContentSettings) { if (contentSetting.IsAssigned) { featureDC.SiteContentSettings.Add(new SiteContentSettingDC { SiteId = contentSetting.SiteId, FeatureId = contentSetting.FeatureId, ContentSettingId = contentSetting.ContentSettingId, IsAssigned = true }); } } serviceRequest.Add(featureDC); } } } ServiceResponse saveSiteFeaturesSettingsResponse = _securityProxy.Execute(opt => opt.SaveSiteFeaturesSettings(serviceRequest)); if (saveSiteFeaturesSettingsResponse.Status != ResponseStatus.Success) HandleError(saveSiteFeaturesSettingsResponse.Status, saveSiteFeaturesSettingsResponse.ResponseMessage); }
public static ModuleFeatureModel Convert(ModuleFeatureDC feature) { var map = Mapper.Resolve<ModuleFeatureDC, ModuleFeatureModel>(MapResolveOptions.UsePrivateSetter); ModuleFeatureModel moduleFeatureModel = Mapper.Map<ModuleFeatureDC, ModuleFeatureModel>(feature); return moduleFeatureModel; }