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)); }
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)); }