lundi 8 août 2016

dynamically changing content of json in ASP.NET Web API

is there any way, how i can re-render page with changed values? In ValuesController i have -

public IEnumerable<Qm> Get()
        {
            return new Qm[]{
                new Qm()
            };
        }

and in constructor of Qm i am starting timer which causes changing values which are rendered

public void getRandomNumbers(Object source, System.Timers.ElapsedEventArgs e)
        {
            Dictionary<string, int> qmRem = new Dictionary<string, int>();
            Dictionary<string, int> qmDec = new Dictionary<string, int>();
            Random random = new Random();
            foreach(KeyValuePair<string,int> i in qm_removed){
                qmRem.Add(i.Key, random.Next(0, 100));
                qmDec.Add(i.Key, random.Next(0, 100));

            }
            qm_removed = qmRem;
            qm_detected = qmDec;
        }

how i cant after this set again re-render new values to web?




Aucun commentaire:

Enregistrer un commentaire