public static void Build(JObject apiResult, CountryCodeCollection countryCodeCollection) { for (int i = 0; i < apiResult["result"]["results"].Count(); i++) { CountryCode countryCode = new CountryCode(); countryCode.FromSql((JObject)apiResult["result"]["results"][i]); countryCodeCollection.Add(countryCode); } }
public static MethodResult GetAll() { string commandText = "Select * from country_code order by name;"; JObject jsonRequest = APIRequestHelper.CreateSubmitSQLCommandMessage(commandText); APIResult apiResult = APIRequestHelper.SubmitAPIRequestMessage(jsonRequest); CountryCodeCollection clientCollection = new CountryCodeCollection(); Build(apiResult.JSONResult, clientCollection); MethodResult methodResult = new MethodResult(); methodResult.AddResult(apiResult.JSONResult, clientCollection); return(methodResult); }