Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("DisciplinaId,Nome")] Disciplina disciplina)
        {
            if (id != disciplina.DisciplinaId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(disciplina);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DisciplinaExists(disciplina.DisciplinaId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(disciplina));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Telefone,TurmaId")] Aluno aluno)
        {
            if (id != aluno.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(aluno);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AlunoExists(aluno.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["TurmaId"] = new SelectList(_context.Turma, "Id", "Id", aluno.TurmaId);
            return(View(aluno));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,NomeTurma,CargaHoraria,DisciplinaId")] Turma turma)
        {
            if (id != turma.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(turma);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TurmaExists(turma.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["DisciplinaId"] = new SelectList(_context.Disciplina, "DisciplinaId", "DisciplinaId", turma.DisciplinaId);
            return(View(turma));
        }