public async Task <IActionResult> Create([Bind("MarcaId,Nome")] Marca marca) { if (ModelState.IsValid) { _context.Add(marca); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(marca)); }
public async Task <IActionResult> Create([Bind("ModeloId,Nome,Ano,MarcaId")] Modelo modelo) { if (ModelState.IsValid) { _context.Add(modelo); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MarcaId"] = new SelectList(_context.Marcas, "MarcaId", "MarcaId", modelo.MarcaId); return(View(modelo)); }