Пример #1
0
        public async Task <IActionResult> Edit(int id, [Bind("IdExcusa,AnexoEvidencia,Nombre1,Nombre2,Apellido1,Apellodo2,Correo,Telefono,RolIdRol")] Excusa excusa)
        {
            if (id != excusa.IdExcusa)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(excusa);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExcusaExists(excusa.IdExcusa))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RolIdRol"] = new SelectList(_context.Rol, "IdRol", "NombreRol", excusa.RolIdRol);
            return(View(excusa));
        }
Пример #2
0
        public async Task <IActionResult> Create([Bind("IdExcusa,AnexoEvidencia,Nombre1,Nombre2,Apellido1,Apellodo2,Correo,Telefono,RolIdRol")] Excusa excusa)
        {
            if (ModelState.IsValid)
            {
                _context.Add(excusa);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["RolIdRol"] = new SelectList(_context.Rol, "IdRol", "NombreRol", excusa.RolIdRol);
            return(View(excusa));
        }