예제 #1
0
        public static FieldSetEntity ToFieldSet(this IDictionary <string, string> values)
        {
            var set = new FieldSetEntity {
                Id = 1
            };

            values.ForEach(kvp => set.Values.Add(new FieldSetValueEntity
            {
                FieldSetId = set.Id,
                Code       = kvp.Key,
                Resource   = new Dictionary <string, string> {
                    { "en", kvp.Value }
                }.ToResource()
            }));

            return(set);
        }
예제 #2
0
 public static SectionFieldEntity CreateField(int sectionId, int fieldId, string type, FieldSetEntity fieldSet = null, ResourceEntity resource = null, byte?sort = null)
 {
     return(new SectionFieldEntity
     {
         SectionId = sectionId,
         FieldId = fieldId,
         DisplaySort = sort ?? Convert.ToByte(fieldId),
         Field = new FieldEntity
         {
             Id = fieldId,
             FieldTypeCode = type,
             FieldSet = fieldSet,
             Resource = resource
         }
     });
 }
예제 #3
0
 public static IList <SelectFieldValue> ToSelectFieldValues(this FieldSetEntity fieldSet, IList <string> languages)
 {
     return(fieldSet?.Values?.Where(v => v.DateDeleted == null).OrderBy(v => v.DisplaySort).Select(v => v.ToSelectFieldValue(languages)).ToList());
 }