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