コード例 #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();
             */
        }
コード例 #2
0
 // GET: Armies
 public async Task <IActionResult> Index()
 {
     return(View(await _armyService.GetAll().ToListAsync()));
 }
コード例 #3
0
 public async Task <ActionResult <IEnumerable <Army> > > GetArmies()
 {
     return(await _armyService.GetAll().ToListAsync());
 }