示例#1
0
 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));
     }
 }
示例#2
0
        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());
            }
        }