public ActionResult Edit(Cliente cliente) { if (ModelState.IsValid) { db.Entry(cliente).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cliente)); }
public ActionResult Edit([Bind(Include = "Id,Nome,SobreNome,DataCadastro")] Cliente cliente) { if (ModelState.IsValid) { db.Entry(cliente).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cliente)); }
public ActionResult Edit([Bind(Include = "Id,Nome,SobreNome,DataCadastro,Email")] Cliente cliente) { if (ModelState.IsValid) { if (!cliente.Email.Contains(".br")) { ModelState.AddModelError(String.Empty, "Email não pode ser internacional!"); return(View(cliente)); } db.Entry(cliente).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(cliente)); }