public IActionResult Get() { try { string cmd = string.Format("execute facturas_selectAll "); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); object[] data = new object[Ds.Tables[0].Rows.Count]; for (int i = 1; i <= Ds.Tables[0].Rows.Count; i++) { data[i - 1] = Ds.Tables[0].Rows[i - 1]; } string JSONresult; JSONresult = JsonConvert.SerializeObject(Ds.Tables[0]); string dataArray = "{\"Data\":" + JSONresult + "}"; return(Ok(dataArray)); } catch (Exception err) { string message = "[{\"status\":\"" + err.Message + "\"}]"; return(StatusCode(200, message)); } }
public IActionResult Put(Data d) { try { string cmd = string.Format("execute recorrer_arrayJson '{0}'" , d.jsonstring.Trim() ); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); return(Ok(Ds)); } catch (Exception err) { return(StatusCode(400, "Revise la sentencia sql" + err)); } }
public IActionResult Post(StringConnection s) { try { string cmd = string.Format("execute articulos_insert '{0}','{1}','{2}','{3}'" , s.source.Trim() , s.database.Trim() , s.user.Trim() , s.password.Trim()); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); return(Ok(Ds)); } catch (Exception err) { return(StatusCode(400, "Revise la sentencia sql" + err)); } }
public IActionResult Get(string user, string pass) { try { string cmd = string.Format("execute demoLogin '{0}','{1}'" , user.Trim() , pass.Trim() ); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); return(Ok(Ds.Tables)); } catch (Exception err) { string message = "[{\"status\":\"" + err.Message + "\"}]"; return(StatusCode(400, message)); } }
public IActionResult Get() { try { string cmd = string.Format("select * from usr_usuarios "); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); string JSONresult; JSONresult = JsonConvert.SerializeObject(Ds.Tables[0]); string dataArray = "{\"Data\":" + JSONresult + "}"; return(Ok(dataArray)); } catch (Exception err) { string message = "[{\"status\":\"" + err.Message + "\"}]"; return(StatusCode(200, message)); } }
public IActionResult Post(Chat c) { try { string cmd = string.Format("exec chats_insert '{0}','{1}','{2}' ", c.ct_usr_sender.ToString() , c.ct_usr_receptor.ToString() , c.ct_mensaje.Trim()); DataSet Ds = SqlServerDbConn.Ejecutar(cmd); string JSONresult; JSONresult = JsonConvert.SerializeObject(Ds.Tables[0]); string dataArray = "{\"Data\":" + JSONresult + "}"; return(Ok(dataArray)); } catch (Exception err) { string message = "[{\"status\":\"" + err.Message + "\"}]"; return(StatusCode(200, message)); } }