private void LoadHeroTypes(string SelectedType = "") { var list = _heroTypeAppService.ListAll(); var selectList = new List <SelectListItem>(); selectList.Add(new SelectListItem()); foreach (var item in list) { selectList.Add(new SelectListItem { Value = item.HeroTypeId.ToString(), Text = item.HeroTypeName, Selected = SelectedType == item.HeroTypeId.ToString() }); } ViewBag.HeroType = selectList; }
// GET: api/HeroTypes public IEnumerable <HeroTypeViewModel> Get() { return(_heroTypeAppService.ListAll()); }
// GET: HeroTypes public ActionResult Index() { return(View(_heroTypeAppService.ListAll())); }