public ActionResult Guardar(Datos.Usuario usuario, string activo) { var rm = new Comun.ResponseModel(); usuario.Activo = activo == "ON" ? true : false; try { if (usuario.Id == 0) { usuario.Clave = usuario.Correo; usuario.IndCambio = false; UsuarioBL.Crear(usuario); } else { UsuarioBL.ActualizarParcial(usuario, x => x.Nombre, x => x.Correo, x => x.Celular, x => x.Activo); } rm.SetResponse(true); rm.href = Url.Action("Index", "Usuario"); } catch (Exception ex) { rm.SetResponse(false, ex.Message); } return(Json(rm, JsonRequestBehavior.AllowGet)); }
public JsonResult CambiarClave(int id, string usuario, string clave) { var rm = new Comun.ResponseModel(); try { //var enc = Comun.HashHelper.MD5(clave); UsuarioBL.ActualizarParcial(new Datos.Usuario { Id = id, Clave = clave, IndCambio = true }, x => x.Clave, x => x.IndCambio); rm.SetResponse(true); Autenticar(new UsuarioVm { Usuario = usuario, Clave = clave }); } catch (Exception ex) { rm.SetResponse(false, ex.Message); } return(Json(rm)); }