public async Task <IActionResult> Edit(int id, [Bind("CodRol,Rol")] TbRol tbRol) { if (id != tbRol.CodRol) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tbRol); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TbRolExists(tbRol.CodRol)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(tbRol)); }
public async Task <IActionResult> Create([Bind("CodRol,Rol")] TbRol tbRol) { if (ModelState.IsValid) { _context.Add(tbRol); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tbRol)); }