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

            return(View(model));
        }