Exemple #1
0
        public IActionResult Edit(int id, [Bind("Id,Nome,Sexo,Email,Nascimento")] Aluno aluno)
        {
            if (id != aluno.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update <Aluno>(aluno);
                    _context.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AlunoExiste(aluno.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }

                return(RedirectToAction(nameof(Index)));
            }

            return(View(aluno));
        }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nome,Email,Rg")] 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)));
            }
            return(View(aluno));
        }
Exemple #3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nota")] Matricula matricula)
        {
            if (id != matricula.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(matricula);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MatriculaExists(matricula.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(matricula));
        }
Exemple #4
0
 public async Task <IActionResult> Edit(Curso curso)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(curso);
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!CursoExists(curso.CursoId))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(curso));
 }
Exemple #5
0
 public void update(int id, Aluno aluno)
 {
     context.Update(aluno);
     context.SaveChanges();
 }