public ActionResult Edit(user user) { try { ViewBag.Message = "Editar User"; IList <role> ilm = r.GetAll().ToList(); ViewBag.roleref = ilm; user.Login = user.Login.Trim(); var senhaCriptografada = Criptografic.Codifica(user.Password); user.Password = senhaCriptografada; var numUser = ur.GetAll().Where(x => x.Login == user.Login && x.Id != user.Id).Count(); if (numUser > 0) { ViewBag.error = "Já existe este login no sistema"; return(View("Edit", user)); } else { ur.Update(user); return(RedirectToAction("Index")); } } catch (Exception) { return(View(user)); } }
public void Modify(fos_user user) { repo.Update(user); }