public static VariablePrompt ToModel(this VariablePromptOptions resource) { var controlType = GetControlType(resource); var selectOptions = GetSelectOptions(resource); return(new VariablePrompt(resource.Required, resource.Label, resource.Description, controlType, selectOptions)); }
static string GetSelectOptions(VariablePromptOptions resource) { if (resource.DisplaySettings.ContainsKey(SelectOptionsKey)) { return(resource.DisplaySettings[SelectOptionsKey]); } return(null); }
static ControlType GetControlType(VariablePromptOptions resource) { if (resource.DisplaySettings.ContainsKey(ControlTypeKey) && Enum.TryParse <ControlType>(resource.DisplaySettings[ControlTypeKey], out var type)) { return(type); } return(ControlType.None); }
public static VariablePrompt ToModel(this VariablePromptOptions resource) { return(new VariablePrompt(resource.Required, resource.Label, resource.Description)); }