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); }
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 } }); }
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()); }