public ActionResult Index() { var teste = new List <Teste>(); var bll = new TesteBll(); string sql = ""; teste = bll.GetList(sql, true); return(View(teste)); }
public ActionResult Edit(int id) { var bll = new TesteBll(); var teste = bll.GetObject(id); if (teste == null) { return(HttpNotFound()); } return(View(teste)); }
public ActionResult Edit(Teste teste, FormCollection collection) { teste.Nome = collection["Nome"]; try { var bll = new TesteBll(); bll.Save(teste); Success("Sucesso", "Salvo com sucesso!", true); return(RedirectToAction("/")); } catch (Exception ex) { Danger("Erro", string.Format(ex.Message), true); return(View(teste)); } }
public ActionResult Create(Teste teste, FormCollection collection) { try { var bll = new TesteBll(); bll.Save(teste); Success("Sucesso", "Salvo com sucesso!", true); return(RedirectToAction("Index")); } catch (Exception ex) { Danger("Erro", string.Format("Erro: " + ex.Message), true); return(View()); } }