コード例 #1
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Matricula,Nombres,Apellidos,Semestre,Telefono")] RegistrarPsicologo registrarPsicologo)
        {
            if (id != registrarPsicologo.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(registrarPsicologo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrarPsicologoExists(registrarPsicologo.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(registrarPsicologo));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Matricula,Nombres,Apellidos,Semestre,Telefono")] RegistrarPsicologo registrarPsicologo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(registrarPsicologo);
                await _context.SaveChangesAsync();

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