public ActionResult Actualizar(string id, string PropertyName, string value) { bool status = false; string mensaje = "No Modificado"; List <Estudiante> estudiante = ActualizarModelo(id, value, PropertyName); Estudiante est = new Estudiante(); if (estudiante != null) { foreach (Estudiante t in estudiante) { if (t.NumeroIdentificacion.Equals(id)) { est.NumeroIdentificacion = id; est.nombre = t.nombre; est.Apellidos = t.Apellidos; est.fechanacimiento = t.fechanacimiento; est.Telefonos = t.Telefonos; est.emails = t.emails; est.idtipoIdentificacion = t.idtipoIdentificacion; est.idtipoUsuario = t.idtipoUsuario; } } ModelUsuarioPut usu = new ModelUsuarioPut(); usu.cargarDatosNuevos(est); string res = api.ConnectPUT(usu.ToJsonString(), "/Usuarios", id); if (res.Equals("1")) { status = true; mensaje = "Valor modificado"; } return(Json(new { value = value, status = status, mensaje = mensaje })); } else { return(Json(new { value = value, status = status, mensaje = mensaje })); } }
public ActionResult Actualizar(string id, string PropertyName, string value) { bool status = false; string mensaje = "No Modificado"; List <Profesor> profesor = ActualizarModelo(id, value, PropertyName); Profesor pro = new Profesor(); if (profesor != null) { foreach (Profesor t in profesor) { if (t.NumeroIdentificacion.Equals(id)) { pro.NumeroIdentificacion = id; pro.nombre = t.nombre; pro.Apellidos = t.Apellidos; pro.fechanacimiento = t.fechanacimiento; pro.Telefonos = t.Telefonos; pro.emails = t.emails; pro.idtipoIdentificacion = t.idtipoIdentificacion; pro.idtipoUsuario = t.idtipoUsuario; } } ModelUsuarioPut usu = new ModelUsuarioPut(); usu.cargarDatosNuevos(pro); string res = api.ConnectPUT(usu.ToJsonString(), "/Usuarios", id); if (res.Equals("1")) { status = true; mensaje = "Valor modificado"; } return(Json(new { value = value, status = status, mensaje = mensaje })); } else { return(Json(new { value = value, status = status, mensaje = mensaje })); } }