public Account GetAccount(string id) { Subject = Proxy; NetResponse NR = Subject.GetAccount(id); if (string.IsNullOrEmpty(NR.JSON)) { Subject = RS; NR = Subject.GetAccount(id); } Account result = new Account(NR.JSON); if (!string.IsNullOrEmpty(result.Id)) { return(result); } else { return(null); } }
public List <Account> GetAccounts() { Subject = Proxy; NetResponse NR = Subject.GetAccounts(); if (!string.IsNullOrEmpty(NR.JSON)) { MemoryStream ms = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(NR.JSON)); DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(List <Account>)); var details = ser.ReadObject(ms) as List <Account>; return(details); } else { Subject = RS; NR = Subject.GetAccounts(); QueryResult <Account> qResult = new QueryResult <Account>(); qResult.HydrateFromJSon(NR.JSON); return(qResult.records); } }