public static Core.Models.Forms.Base.BoolField ToModel(this Entities.Forms.BoolField field) { Type fieldType = field.GetType(); if (fieldType == typeof(SwitchField)) { return(new SwitchField { DefaultValue = field.DefaultValue, Description = field.Description, DisplayName = field.DisplayName, FieldName = field.FieldName, IsRequired = field.IsRequired }); } throw new NotImplementedException($"unrecoganized bool field type: {fieldType.Name.ToLower()}"); }
public virtual Core.Models.Forms.Base.BoolField ToModel(Entities.Forms.BoolField field) { var fieldType = field.FieldType; switch (fieldType) { case FieldTypes.Switch: return(new SwitchField { DefaultValue = field.DefaultValue, Description = field.Description, DisplayName = field.DisplayName, FieldName = field.FieldName, IsRequired = field.IsRequired }); } throw new InvalidOperationException($"unknown field type {fieldType}"); }