Beispiel #1
0
        public ActionResult <Dictionary <string, List <Trend> > > Get(string from, string to, string ora_from, string ora_to, string country)
        {
            try
            {
                //tendenze attuali
                Trend        ultimo  = _trendsService.Latest("ALL");
                DateTime     data_rl = ultimo.Timestamp;
                List <Trend> lasts   = _trendsService.GetByTimestampNotGrouped(data_rl, "ALL");
                //.Where(x=>x.Name.StartsWith("#")).ToList();

                var group = lasts.GroupBy(o => o.Country.ToLower(), StringComparer.InvariantCultureIgnoreCase)
                            .ToList().ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());

                var per_hashtag = (from item in lasts
                                   group item by item.Country
                                   into categorieClass
                                   select categorieClass).ToDictionary(gdc => gdc.Key, gdc => gdc.ToList());

                return(per_hashtag);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
                throw;  //new ArgumentException( $"Mancano alcuni parametri");
            }
        }
        public ActionResult <List <Trend> > Get(string country)
        {
            try
            {
                Trend ultimo = _trendsService.Latest(country);

                DateTime data_rl = ultimo.Timestamp;

                List <Trend> lasts = _trendsService.GetByTimestamp(data_rl, country.ToUpper());


                return(lasts);
            }
            catch (System.Exception e)
            {
                Console.WriteLine(e.Message);
                throw;  //new ArgumentException( $"Mancano alcuni parametri");
            }
        }