// GET: /<controller>/
        public async Task <IActionResult> Index()
        {
            #region 部门

            List <ConfigInfo> depts = await _configInfoService.GetListByType((int)ConfigInfoType.Department);

            ViewBag.Depts = depts;
            #endregion
            return(View());
        }
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "select";
            output.Content.Clear();

            IEnumerable <ConfigInfo> configInfos = await _configInfoService.GetListByType((int)ConfigInfoType.Area);

            foreach (var item in configInfos)
            {
                var selected = "";
                if (item.Id == DefaultValue)
                {
                    selected = "selected =\"selected\"";
                }

                var listItem = $"<option value=\"{item.Id}\" {selected}>{item.Name}</option> ";
                output.Content.AppendHtml(listItem);
            }
        }
Beispiel #3
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "select";
            output.Content.Clear();

            IEnumerable <ConfigInfo> configInfos = await _configInfoService.GetListByType((int)ConfigInfoType.Department);

            if (DefaultName.IsNotNullOrEmpty())
            {
                output.Content.AppendHtml(string.Format("<option value=\"{0}\">{1}</option>", 0, DefaultName));
            }

            foreach (var item in configInfos)
            {
                var selected = "";
                if (item.Id == DefaultValue)
                {
                    selected = "selected =\"selected\"";
                }

                var listItem = $"<option value=\"{item.Id}\" {selected}>{item.Name}</option> ";
                output.Content.AppendHtml(listItem);
            }
        }