public static SCIMSchemaModel ToModel(this SCIMSchema schema) { var result = new SCIMSchemaModel { Description = schema.Description, Id = schema.Id, IsRootSchema = schema.IsRootSchema, Name = schema.Name, ResourceType = schema.ResourceType, SchemaExtensions = schema.SchemaExtensions.Select(s => new SCIMSchemaExtensionModel { Id = s.Id, Required = s.Required, Schema = s.Schema }).ToList(), Attributes = schema.Attributes.Select(s => ToModel(s, schema.Id)).ToList() }; return(result); }
public static SCIMSchema ToDomain(this SCIMSchemaModel schema) { var result = new SCIMSchema { Id = schema.Id, Description = schema.Description, IsRootSchema = schema.IsRootSchema, Name = schema.Name, ResourceType = schema.ResourceType, Attributes = schema.Attributes.Where(a => string.IsNullOrEmpty(a.ParentId)).Select(a => ToDomain(a)).ToList(), SchemaExtensions = schema.SchemaExtensions.Select(s => new SCIMSchemaExtension { Id = s.Id, Required = s.Required, Schema = s.Schema }).ToList() }; return(result); }