Example #1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID_rol,nombre_rol,descripcion")] rol rol)
        {
            if (id != rol.ID_rol)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(rol);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!rolExists(rol.ID_rol))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(rol));
        }
Example #2
0
        public async Task <IActionResult> Edit(string id, [Bind("ID_area,Nombre_area")] area area)
        {
            if (id != area.ID_area)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(area);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!areaExists(area.ID_area))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(area));
        }