public static void CopyFrom(FieldComponentModel model, StoreFormField field) { model.StoreField = field.GetCopy(); model.Order = field.Order; model.ComponentType = GetComponentType(field.ControlType); model.FilterType = string.IsNullOrWhiteSpace(field.FilterType) ? FieldFilterType.None : Enum.Parse <FieldFilterType>(field.FilterType); if (field.Rules != null) { model.Rules = field.Rules.Select(x => new FieldRuleModel { Name = x.Name, Code = x.Code, Trigger = Enum.Parse <FormRuleTriggers>(x.Trigger) }).ToList(); } else { model.Rules = new List <FieldRuleModel>(); } }
public FieldComponentModel(StoreFormField f) { CopyFrom(this, f); }