예제 #1
0
        //You have to create a Enum...AttributeSttring to translate with description given in enum class
        #region TRANSLATE ENUM
        public IEnumerable <string> GetEnumChoiceAttributeString()
        {
            //This return the custom attribute string value.
            string[]      choices     = Enum.GetNames(typeof(LuisBot.Enums.ChoicesTypes));
            List <string> choicesList = new List <string>();

            foreach (string choice in choices)
            {
                ChoicesTypes onechoice = (ChoicesTypes)Enum.Parse(typeof(ChoicesTypes), choice);
                //This return the custom attribute string value.
                choicesList.Add(onechoice.GetStringValue());
            }
            IEnumerable <string> choicesEnum = choicesList.AsEnumerable <string>();

            return(choicesEnum);
        }
예제 #2
0
        private async Task <string> _getFormGroupForSelectList(ModelExplorer property, IEnumerable <SelectListItem> items,
                                                               ChoicesTypes choicesType, TweakingConfiguration tweakingConfig)
        {
            string label = await buildLabelHtml(property, tweakingConfig);

            string select = "";

            if (choicesType == ChoicesTypes.RADIO)
            {
                select = await buildRadioInputsHtml(property, items, tweakingConfig);
            }
            else
            {
                select = await buildSelectHtml(property, items, tweakingConfig);
            }

            string validation = await buildValidationMessageHtml(property, tweakingConfig);

            return($@"<div class='form-group'>
                {label}
                {select}
                {validation}
</div>");
        }