public async Task <IActionResult> Edit(int id, [Bind("id,nombre,descripcion")] Rol rol) { if (id != rol.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(rol); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RolExists(rol.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(rol)); }
public async Task <ActionResult <RolesModel> > aPut(int id, [FromBody] RolesModel payload) { using (var rc = new RolesContext()) { var aw = await rc.Rolmc.FindAsync(id); if (aw == null) { return(BadRequest("id not found")); } /* Selecciona la "lista" del id (parametros del id) */ aw.nombrerol = payload.nombrerol; rc.Update(aw); await rc.SaveChangesAsync(); return(Ok(aw)); } }