// GET: Placars/Create public async Task <IActionResult> Create() { //ViewData["JogadorId"] = new SelectList(_context.Jogador, "Id", "Id"); var jogadores = await _jogadorService.FindAllAsync(); var viewModel = new PlacarFormsViewModel { Jogadores = jogadores }; return(View(viewModel)); }
public async Task <IActionResult> Edit(int?id) { if (id == null) { return(NotFound()); } var placar = await _context.Placar.FindAsync(id); var jogadores = _context.Jogador.OrderBy(x => x.Id).ToList(); if (placar == null) { return(NotFound()); } var vm = new PlacarFormsViewModel { Jogadores = jogadores, Placar = placar }; return(View(vm)); }