public async Task <IActionResult> Create([Bind("Id,Nome,CPF,Telefone")] Professor professor)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professor);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professor));
        }
        public async Task <IActionResult> Create([Bind("Id,Nome,RG,Telefone")] Aluno aluno)
        {
            if (ModelState.IsValid)
            {
                _context.Add(aluno);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(aluno));
        }
Пример #3
0
        public async Task <IActionResult> Create([Bind("Id,Nome,Descricao,Idioma,Nivel,Periodo,ProfessorId")] Turma turma)
        {
            if (ModelState.IsValid)
            {
                _context.Add(turma);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ProfessorId"] = new SelectList(_context.Professores, "Id", "CPF", turma.ProfessorId);
            return(View(turma));
        }
Пример #4
0
        public async Task <IActionResult> Create([Bind("AlunoId,TurmaId")] AlunoTurma alunoTurma)
        {
            if (ModelState.IsValid)
            {
                _context.Add(alunoTurma);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AlunoId"] = new SelectList(_context.Alunos, "Id", "Nome", alunoTurma.AlunoId);
            ViewData["TurmaId"] = new SelectList(_context.Turmas, "Id", "Idioma", alunoTurma.TurmaId);
            return(View(alunoTurma));
        }