public MensajeRespuesta accionProfesionales(Message mensajeSolicitud) { CRUDProfesionales cp = new CRUDProfesionales(); MensajeRespuesta mensaje; try { //MethodInfo method = cu.GetType().GetMethod("inicioSesion"); System.Diagnostics.Debug.WriteLine("acción pedida: " + mensajeSolicitud.accion); MethodInfo metodo = cp.GetType().GetMethod(mensajeSolicitud.accion); object result = metodo.Invoke(cp, mensajeSolicitud.parametrosMetodo()); if (result != null) { System.Diagnostics.Debug.WriteLine("muestra un mensaje"); System.Diagnostics.Debug.WriteLine(result.ToString()); } //MensajeRespuesta mensaje = new MensajeRespuesta { exito = 1 , datos = el.ToArray()}; mensaje = new MensajeRespuesta { exito = 1, datos = result, mensajeExito = "Operación exitosa" }; return mensaje; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); mensaje = new MensajeRespuesta { exito = 0, mensajeError = "Error al obtener los datos", datos = e.Message }; return mensaje; } }
public Image imagenProfesional() { System.Diagnostics.Debug.WriteLine("pide imagen"); byte[] datos = new CRUDProfesionales().imagen("awe"); System.Diagnostics.Debug.WriteLine(datos.Length); MemoryStream ms = new MemoryStream(datos); HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK); response.Content = new ByteArrayContent(ms.ToArray()); response.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png"); System.Diagnostics.Debug.WriteLine("pide"); Image returnImage = Image.FromStream(ms); return returnImage; }