예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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));
        }