public async Task <IActionResult> Create([Bind("Id,Nome")] Turma turma) { if (ModelState.IsValid) { _context.Add(turma); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(turma)); }
public async Task InsertAsync(Aluno obj) { //obj.Turma = _context.Turma.First(); _context.Add(obj); //adicionando aluno na db await _context.SaveChangesAsync(); //salvando }