Example #1
0
        public static Model.MetadataField FromDataModel(Core.Data.MetadataField source)
        {
            if (source == null)
            {
                return(null);
            }

            var f = new Model.MetadataField
            {
                ID              = source.Id,
                Title           = source.Title,
                MetadataGroupID = source.MetadataGroupId,
                DataTypeID      = source.DataTypeId
            };

            if (source.MetadataFieldOptions != null)
            {
                foreach (var o in source.MetadataFieldOptions)
                {
                    if (f.MetadataFieldOptions == null)
                    {
                        f.MetadataFieldOptions = new List <Model.MetadataFieldOption>();
                    }
                    f.MetadataFieldOptions.Add(Extensions.MetadataFieldOption.FromDataModel(o));
                }
            }
            return(f);
        }
Example #2
0
        public static Model.MetadataField FromDataModel(Core.Data.MetadataField source)
        {
            if (source == null) return null;

            var f = new Model.MetadataField
            {
                ID = source.ID,
                Title = source.Title,
                MetadataGroupID = source.MetadataGroupID,
                DataTypeID = source.DataTypeID
            };

            if (source.MetadataFieldOptions!=null)
            {

                foreach (var o in source.MetadataFieldOptions)
                {
                    if (f.MetadataFieldOptions==null) f.MetadataFieldOptions = new List<Model.MetadataFieldOption>();
                    f.MetadataFieldOptions.Add(Extensions.MetadataFieldOption.FromDataModel(o));
                }
            }
            return f;
        }