Example #1
0
        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));
        }
Example #2
0
        static string GetSelectOptions(VariablePromptOptions resource)
        {
            if (resource.DisplaySettings.ContainsKey(SelectOptionsKey))
            {
                return(resource.DisplaySettings[SelectOptionsKey]);
            }

            return(null);
        }
Example #3
0
        static ControlType GetControlType(VariablePromptOptions resource)
        {
            if (resource.DisplaySettings.ContainsKey(ControlTypeKey) &&
                Enum.TryParse <ControlType>(resource.DisplaySettings[ControlTypeKey], out var type))
            {
                return(type);
            }

            return(ControlType.None);
        }
Example #4
0
 public static VariablePrompt ToModel(this VariablePromptOptions resource)
 {
     return(new VariablePrompt(resource.Required, resource.Label, resource.Description));
 }