Beispiel #1
0
        public async Task <Dictionary <string, GeoEntityCount> > GetGeoCount(CloudTable geoTable)
        {
            Dictionary <string, int>            _geoCount = JsonConvert.DeserializeObject <Dictionary <string, int> >(this.GeoCount ??= "{}");;
            Dictionary <string, GeoEntityCount> response  = new Dictionary <string, GeoEntityCount>();

            foreach (string key in _geoCount.Keys)
            {
                response.Add(key, new GeoEntityCount(await GeoEntity.get(geoTable, key), _geoCount[key]));
            }

            return(response);
        }
Beispiel #2
0
        public static async Task <bool> put(CloudTable geoTable, GeoEntity entityToInsert)
        {
            await geoTable.CreateIfNotExistsAsync();

            try {
                GeoEntity entity = await GeoEntity.get(geoTable, entityToInsert.RowKey);

                if (entity != null)
                {
                    return(true);
                }

                TableOperation insertGeoOperation = TableOperation.InsertOrMerge(entityToInsert);
                await geoTable.ExecuteAsync(insertGeoOperation);
            }
            catch {
                return(false);
            }
            return(true);
        }