// GET: Castles/Create public IActionResult Create() { var armyList = _armyService.GetAll().OrderBy(x => x.Name); ViewData["ArmyId"] = new SelectList(armyList, "Id", "Name"); return(View()); /* Scaffolded code * ViewData["ArmyId"] = new SelectList(_castleService.Armies, "Id", "Id"); * return View(); */ }
// GET: Armies public async Task <IActionResult> Index() { return(View(await _armyService.GetAll().ToListAsync())); }
public async Task <ActionResult <IEnumerable <Army> > > GetArmies() { return(await _armyService.GetAll().ToListAsync()); }