Example #1
0
        private async Task <IEnumerable <Remark> > GetRemarksByLocationAsync(BrowseRemarksBase query)
        {
            var radius  = query.Radius > 0 ? query.Radius : 10000;
            var geoKeys = await _cache.GetGeoRadiusAsync("remarks",
                                                         query.Longitude, query.Latitude, radius);

            if (geoKeys == null || !geoKeys.Any())
            {
                return(Enumerable.Empty <Remark>());
            }
            var remarks = await _cache.GetManyAsync <Remark>(geoKeys
                                                             .OrderBy(x => x.Distance)
                                                             .Select(x => $"remarks:{x.Name}")
                                                             .ToArray());

            remarks = remarks?.Where(x => x != null) ?? Enumerable.Empty <Remark>();

            return(remarks);
        }
Example #2
0
 public static bool IsLocationProvided(this BrowseRemarksBase query)
 => (Math.Abs(query.Latitude) <= 0.0000000001 ||
     Math.Abs(query.Longitude) <= 0.0000000001) == false;