Esempio n. 1
0
        static public async Task <List <Product> > search_items(string searchTerm)
        {
            string    url = SERVER_URL + "/search/" + searchTerm;
            DataCache dc  = new DataCache();

            if (dc.get(url) != null)
            {
                return(Product.listFromJson(dc.get(url)));
            }

            try {
                string data = await WebService.stringFromUrl(new Uri(url));

                dc.set(url, data);
                return(Product.listFromJson(data));
            }
            catch (System.Net.WebException) {
                return(new List <Product>());
            }
        }
Esempio n. 2
0
        static public async Task <List <Product> > get_member_sales()
        {
            string    url = SERVER_URL + "/membersales/";
            DataCache dc  = new DataCache();

            if (dc.get(url) != null)
            {
                return(Product.listFromJson(dc.get(url)));
            }

            try {
                string data = await WebService.stringFromUrl(new Uri(url));

                dc.set(url, data);
                return(Product.listFromJson(data));
            }
            catch (System.Net.WebException) {
                return(new List <Product>());
            }
        }