Ejemplo n.º 1
0
        public ActionResult Index()
        {
            var teste = new List <Teste>();
            var bll   = new TesteBll();

            string sql = "";

            teste = bll.GetList(sql, true);

            return(View(teste));
        }
Ejemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            var bll   = new TesteBll();
            var teste = bll.GetObject(id);



            if (teste == null)
            {
                return(HttpNotFound());
            }

            return(View(teste));
        }
Ejemplo n.º 3
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));
     }
 }
Ejemplo n.º 4
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());
            }
        }