Beispiel #1
0
        // 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();
             */
        }
Beispiel #2
0
 // 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());
 }