Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
 public void Insert(Turma obj)
 {
     _context.Add(obj);
     _context.SaveChanges();
 }