private ICollection <LandmarkDto> TryGetLandmarksWithinZone(double latitude, double longitude, double distance) { ICollection <Landmark> retrieved = landmarks.GetWithinZone(latitude, longitude, distance); ICollection <LandmarkDto> dtos = GetLandmarkDtos(retrieved); return(dtos); }
public async Task <bool> NotifyIfCloseToLandmark(string token, double lat, double lng) { DateTime time; if (!tokenCache.TryGetValue(token, out time)) { //500 m distance, get first landmark. ICollection <Landmark> closeLandmarks = landmarks.GetWithinZone(lat, lng, proximityDistance, 0, 1); if (closeLandmarks.Any()) { Landmark toSend = closeLandmarks.First(); SendPushNotification(token, toSend, ComputeDistanceMeters(lat, lng, toSend.Latitude, toSend.Longitude)); tokenCache.Set(token, DateTime.Now, DateTimeOffset.UtcNow.AddHours(intervalBetweenNotifications)); return(true); } } return(false); }