public static List <PhoneType> GetPhoneTypes(int _id = 0) { if (phoneTypes == null) { List <PhoneType> types = new List <PhoneType>(); //Dictionary<string, string> parms = new Dictionary<string, string>(); //if (id > 0) // parms.Add(DBKeys.PhoneType.ID, id.ToString()); string response = Functions.readRequest(Properties.Resources.base_url + "phone/types"); JArray jsonArray = JArray.Parse(response); foreach (JObject item in jsonArray) { string str = item.ToString(); PhoneType newPhoneType = parsePhoneType(str); if (newPhoneType != null) { types.Add(newPhoneType); } } types.Sort(); phoneTypes = types; } return(phoneTypes); }
public static PhoneType GetPhoneType(int _id) { PhoneType pt = new PhoneType(); if (phoneTypes == null) { GetPhoneTypes(); } if (_id > 0) { pt = phoneTypes.Find(x => x.id.Equals(_id)); } return(pt); }