public List <Tuple <string, string> > Get(int take, int skip)
        {
            var artists = new List <Tuple <string, string> >();

            if (take > maxReturn)
            {
                take = maxReturn;
            }

            var cloudTableClient = AzureService.GetCloudTableClient();
            var cloudTable       = cloudTableClient.GetTableReference("artists");

            var query = new TableQuery();
//            query.TakeCount = take;
//            query.Where(TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, "Ludacris"));
            var results = cloudTable.ExecuteQuery(query);

            results = results.Skip(skip);
            results = results.Take(take);

            foreach (DynamicTableEntity result in results)
            {
                string artistName = result.RowKey;
                string songCount  = result.Properties["numSongs"].StringValue;
                var    artist     = new Tuple <string, string>(artistName, songCount);
                artists.Add(artist);
            }

            return(artists);
        }
Exemple #2
0
        public List <Tuple <string, string> > Get()
        {
            var genres = new List <Tuple <string, string> >();

            var        cloudTableClient = AzureService.GetCloudTableClient();
            var        cloudTable       = cloudTableClient.GetTableReference("genres");
            TableQuery query            = new TableQuery();
            var        results          = cloudTable.ExecuteQuery(query);

            foreach (DynamicTableEntity result in results)
            {
                string genre      = result.RowKey;
                string songCount  = result.Properties["numSongs"].StringValue;
                var    genreTuple = new Tuple <string, string>(genre, songCount);
                genres.Add(genreTuple);
            }

            return(genres);
        }
Exemple #3
0
        public List <Segment> Get(int take, int skip)
        {
            var segements = new List <Segment>();

            if (take > maxReturn)
            {
                take = maxReturn;
            }

            var cloudTableClient = AzureService.GetCloudTableClient();
            var cloudTable       = cloudTableClient.GetTableReference("segments");

            var query   = new TableQuery();
            var results = cloudTable.ExecuteQuery(query);

            results = results.Skip(skip);
            results = results.Take(take);

            foreach (DynamicTableEntity result in results)
            {
                var segment = new Segment();
                segment.SegmentAll = result.RowKey;
                segment.Genre      = result.Properties["genre"].StringValue;
                if (result.Properties.Keys.Contains("segement0"))
                {
                    segment.Segment0 = result.Properties["segement0"].StringValue;
                }
                if (result.Properties.Keys.Contains("segement1"))
                {
                    segment.Segment1 = result.Properties["segement1"].StringValue;
                }
                if (result.Properties.Keys.Contains("segement2"))
                {
                    segment.Segment2 = result.Properties["segement2"].StringValue;
                }

                segements.Add(segment);
            }

            return(segements);
        }