public IActionResult Create(Cargo cargo) { if (ModelState.IsValid) { if (_cargoDAO.Cadastrar(cargo)) { return(RedirectToAction(nameof(Index), nameof(Cargo))); } ModelState.AddModelError("", "Esse Cargo ja Existe!"); } return(View(cargo)); }
public IActionResult Index(Cargo c) { _cargoDAO.Cadastrar(c); ViewBag.ListaCargo = _cargoDAO.Listar(); return(View()); }