I am trying to streamline the process of returning the data from my WebMethod layer to the client and represent the set of parameters in coming from the client in a Dictionary<string,string>
to do something like this:
[WebMethod(EnableSession = true)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static override ResultObject<List<PatientInfo>> GetResults(Dictionary<string, string> query)
{
ResultObject<List<PatientInfo>> resultObject = null;
if (!query.ContainsKey("finValue"))
{
resultObject = new ResultObject<List<PatientInfo>>("Missing finValue parameter from the query");
}
string finValue = query["finValue"];
if(finValue == null)
{
resultObject = new ResultObject<List<PatientInfo>>("Missing finValue parameter value from the query");
}
var patientData = GetPatientsByFin(finValue);
resultObject = new ResultObject<List<PatientInfo>>(patientData);
return resultObject;
}
}
My question is: how do I pass and de-serialize the Dictionary parameter?