public ActionResult Create(FormCollection collection) { try { Instituicao instituicao = new Instituicao(); instituicao.Nome = collection["Nome"]; instituicao.Cnpj = collection["Cnpj"]; InstituicaoDAO.Persistir(instituicao); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { Instituicao instituicao = new Instituicao(); instituicao.Id = id; instituicao.Nome = collection["Nome"]; instituicao.Cnpj = collection["Cnpj"]; if (!InstituicaoDAO.Persistir(instituicao)) { return(View()); } return(RedirectToAction("Index")); } catch { return(View()); } }