Ejemplo n.º 1
0
	    public static void UpdateTokenInfo(string token)
	    {
	        TokenDatabase database;
	        List<TokeInformation> lstTokeInformations;
	        try
	        {
	            database = new TokenDatabase();
	            lstTokeInformations = database.GetItems().ToList();
	            if (lstTokeInformations.Any())
	            {
	                var item = lstTokeInformations.FirstOrDefault();
	                item.access_token = token;
	                database.SaveItem(item);
	            }
	        }
	        catch (Exception ex)
	        {
	            throw new Exception(message: ex.Message);
	        }
	        finally
	        {
	            database = null;
	            lstTokeInformations = null;
	        }


	    }
Ejemplo n.º 2
0
        public static string GetTokenInfo()
        {
            string accToken = "";
            TokenDatabase database;
            List<TokeInformation> lstTokeInformations;
            try
            {
                database = new TokenDatabase();
                lstTokeInformations = database.GetItems().ToList();
                if (lstTokeInformations.Any())
                {
                    var item = lstTokeInformations.FirstOrDefault();
                    accToken = item.access_token;
                }
                return accToken;
            }
            catch (Exception ex)
            {
                throw new Exception(message: ex.Message);
            }
            finally
            {
                database = null;
                lstTokeInformations = null;
            }

        }