// GET: Armies/Create public IActionResult Create() { var castleList = _castleService.GetAll().OrderBy(x => x.Name); ViewData["CastleId"] = new SelectList(castleList, "Id", "Id"); return(View()); }
// GET: Castles public async Task <IActionResult> Index() { var Castles = await _castleService.GetAll() .Include(x => x.Army) .ToListAsync(); return(View(Castles)); /* Scaffolded code * var applicationDBContext = _castleService.Castles.Include(c => c.Army); * return View(await applicationDBContext.ToListAsync()); */ }