Esempio n. 1
0
        //public static MvcHtmlString DropDownList(this HtmlHelper htmlHelper, string name, IBusinessIdentifier selectedValue, string optionLabel)
        //{
        //    return htmlHelper.DropDownList(name, selectedValue, optionLabel, null /* htmlAttributes */);
        //}

        //public static MvcHtmlString DropDownList(this HtmlHelper htmlHelper, string name, IBusinessIdentifier selectedValue, string optionLabel, object htmlAttribute)
        //{
        //    var selectList = htmlHelper.ViewData.Eval(name) as IEnumerable<SelectListItem>;
        //    //selectList.FirstOrDefault(x => x.Value == selectedValue.ToString()).Selected = true;
        //    return htmlHelper.DropDownList(name, selectList, optionLabel);
        //}

        public static MvcHtmlString Visible <T>(this MvcHtmlString html, T entity, params Type[] stateTypes)
            where T : Entity <T>
        {
            var type = StateFactory.GetCurrentState(entity).GetType();

            if (stateTypes.Any(x => x == type || type.IsSubclassOf(x)))
            {
                return(html);
            }
            return(MvcHtmlString.Empty);
        }