Можно ли вызвать API с параметром объекта [] в качестве параметра
[HttpGet("{procName}/{parametarList}")]
public ActionResult<string> Get(string procName , params object[] parametarList)
{
string JSONString = string.Empty;
using (var ado = new ADO())
{
var ds = ado.ExecuteAndReturnDS("execute " + procName " @0, @1, @2,@3,@4,@5", parametarList);
JSONString = JsonConvert.SerializeObject(ds.Tables[0]);
return new JsonResult(JSONString);
}
}
public DataSet ExecuteAndReturnDS(string upit, params object[] parametri)
{
try
{
_Conn();
command = new SqlCommand(upit, _Conn);
command.CommandTimeout = 200;
_ds = new DataSet();
_sqlda = new SqlDataAdapter(command);
for (int i = 0; i <= parametri.Count() - 1; i++)
{
if (parametri[i] == null)
{
command.Parameters.AddWithValue("@" + i, DBNull.Value);
}
else
{
command.Parameters.AddWithValue("@" + i, parametri[i]);
}
}
_sqlda.Fill(_ds);
if (_Conn.State == ConnectionState.Open)
{
_sqlda.Dispose();
_Conn.Dispose();
_Conn.Close();
}
return _ds;
}
catch (Exception ex)
{
return null;
}
}
Как это / api / values / myProcedure / param1 / param2 / param3 / param4 / etc /