public async Task <IActionResult> Create([Bind("TipoProvaID,Nome,Descricao")] TipoProva tipoProva) { if (ModelState.IsValid) { _context.Add(tipoProva); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tipoProva)); }
public async Task <IActionResult> Create([Bind("ProfessorId,Nome,Idade,Email,Telemovel")] Professor professor) { if (ModelState.IsValid) { _context.Add(professor); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(professor)); }
public async Task <IActionResult> Create([Bind("EstudanteId,DisciplinaId")] EstudanteDisciplina estudanteDisciplina) { if (ModelState.IsValid) { _context.Add(estudanteDisciplina); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EstudanteId"] = new SelectList(_context.Disciplina, "DisciplinaId", "DisciplinaId", estudanteDisciplina.EstudanteId); return(View(estudanteDisciplina)); }
public async Task <IActionResult> Create([Bind("DisciplinaId,Nome,Ano,Email,NumeroEstudante,EstadoEstudante,ProfessorId")] Disciplina disciplina) { if (ModelState.IsValid) { _context.Add(disciplina); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ProfessorId"] = new SelectList(_context.Professor, "ProfessorId", "Nome", disciplina.ProfessorId); return(View(disciplina)); }
public async Task <IActionResult> Create([Bind("HorarioId,DisciplinaId")] HorarioDisciplina horarioDisciplina) { if (ModelState.IsValid) { _context.Add(horarioDisciplina); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HorarioId"] = new SelectList(_context.Disciplina, "DisciplinaId", "DisciplinaId", horarioDisciplina.HorarioId); ViewData["DisciplinaId"] = new SelectList(_context.Horario, "HorarioId", "HorarioId", horarioDisciplina.DisciplinaId); return(View(horarioDisciplina)); }
public async Task <IActionResult> Create([Bind("HorarioId,NomeProva,Datainicio,DiaInteiro,Datafim,Descricao,Ano,TipoProvaID")] Horario horario) { if (ModelState.IsValid) { horario.TipoProva = _context.TipoProva.Find(horario.TipoProvaID); _context.Add(horario); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["Disciplinas"] = new SelectList(_context.Disciplina, "Nome", "Nome"); ViewData["TipoProvaID"] = new SelectList(_context.TipoProva, "TipoProvaID", "Nome", horario.TipoProvaID); return(View(horario)); }