public async Task <IActionResult> Create([Bind("DisciplinaId,Nome")] Disciplina disciplina) { if (ModelState.IsValid) { _context.Add(disciplina); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(disciplina)); }
public async Task <IActionResult> Create([Bind("Id,Nome,Telefone,TurmaId")] Aluno aluno) { if (ModelState.IsValid) { _context.Add(aluno); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TurmaId"] = new SelectList(_context.Turma, "Id", "Id", aluno.TurmaId); return(View(aluno)); }
public async Task <IActionResult> Create([Bind("Id,NomeTurma,CargaHoraria,DisciplinaId")] Turma turma) { if (ModelState.IsValid) { _context.Add(turma); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DisciplinaId"] = new SelectList(_context.Disciplina, "DisciplinaId", "DisciplinaId", turma.DisciplinaId); return(View(turma)); }
public void Insert(Turma obj) { _context.Add(obj); _context.SaveChanges(); }