Exemple #1
0
 public ActionResult Edit(Marca marca)
 {
     if (ModelState.IsValid)
     {
         marca.nome = marca.nome.ToUpper();
         marca.ConfigurarParaSalvar();
         db.Entry(marca).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(marca));
 }
Exemple #2
0
        public ActionResult Create(Marca model)
        {
            if (ModelState.IsValid)
            {
                model.nome = model.nome.ToUpper();
                if (VerificaJaExiste(model))
                {
                    ViewBag.Erro = "Ja existe um registro com os valores informados!";
                    return(View(model));
                }
                model.ConfigurarParaSalvar();
                db.Marca.Add(model);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }