public override void Process(TagHelperContext context, TagHelperOutput output) { var allEditions = editionService.GetEditions(); output.TagName = "select"; output.Attributes.SetAttribute("id", For.Name); output.Attributes.SetAttribute("name", For.Name); output.Attributes.Add("class", "form-control"); foreach (var edition in allEditions) { TagBuilder option = new TagBuilder("option") { TagRenderMode = TagRenderMode.Normal }; option.Attributes.Add("value", edition.Name); option.InnerHtml.Append(edition.Name); output.Content.AppendHtml(option); } }
// GET: Editions public ActionResult Index() { IEnumerable <Editions> allEditions = editions.GetEditions().OrderBy(x => x.Year); return(View(allEditions)); }