我的模特儿里有这门课:
public class GetDocParams {
public string LogonTicket { get; set; }
public int CliRid { get; set; }
public string[] ValPairs { get; set; }
public string SortBy { get; set; }
public int StartRec { get; set; }
public int EndRec { get; set; }
}这将用作WebApi2函数的输入,以从实体框架检索查询结果。
该函数从输入中获取valPairs,并使用它构建按传递的对排序的查询,即
CLI_RID=111111
DOC_NAME=Letter将创建SQL:
WHERE CLI_RID = 111111
AND DOC_NAME = 'Letter'我有点好奇,如何使用ajax和/或WebClient传递WebClient?得到或张贴并不重要。
发布于 2015-12-10 02:49:23
您可能必须为ValPair添加一个新类,如下所示。
public class GetDocParams {
public string LogonTicket { get; set; }
public int CliRid { get; set; }
public ValPair[] ValPairs { get; set; }
public string SortBy { get; set; }
public int StartRec { get; set; }
public int EndRec { get; set; }
}
public class ValPair {
public int CLI_RID { get; set; }
public string DOC_NAME { get; set; }
}您可以通过以下GET API调用将值传递给参数:http://www.example.com/api/docs/getDocParams?LogonTicket=111&ValPairs[0][CLI_RID]=111111&ValPairs[0][DOC_NAME]=Letter&ValPairs[1][CLI_RID]=22222&ValPairs[1][DOC_NAME]=document&...。
如果你知道钥匙的名字,这应该是可行的。
https://stackoverflow.com/questions/34190202
复制相似问题