Example #1
0
        List <CryptoCoin> ListByText(string query)
        {
            List <CryptoCoin> lstCoins = new List <CryptoCoin>();
            string            Name;
            string            Sym;

            foreach (var item in myStuff.data)
            {
                Name = item.name;
                Sym  = item.symbol;
                if (Sym.ToLower().Contains(query.ToLower()) || Name.ToLower().Contains(query.ToLower()))
                {
                    CryptoCoin newCoin = new CryptoCoin();
                    newCoin.Name       = item.name;
                    newCoin.Symbol     = item.symbol;
                    newCoin.Price      = item.quote.USD.price;
                    newCoin.UpdateDate = item.quote.USD.last_updated + " UTC";

                    lstCoins.Add(newCoin);
                }
                else
                {
                    continue;
                }
            }
            return(lstCoins);
        }
Example #2
0
        List <CryptoCoin> ListAll()
        {
            List <CryptoCoin> lstCoins = new List <CryptoCoin>();


            foreach (var item in myStuff.data)
            {
                try {
                    CryptoCoin newCoin = new CryptoCoin();
                    newCoin.Name       = item.name;
                    newCoin.Symbol     = item.symbol;
                    newCoin.Price      = item.quote.USD.price;
                    newCoin.UpdateDate = item.quote.USD.last_updated + " UTC";

                    lstCoins.Add(newCoin);
                }
                catch
                {
                    continue;
                }
            }
            return(lstCoins);
        }