예제 #1
0
        /// <summary>
        /// Filters the Geocoordinates based on the distance and converts the distance to  miles.
        /// </summary>
        /// <returns> an object that contains the geocoordinates in the radius </returns>
        public Outcome Execute()
        {
            var response        = new Outcome();
            var coordDictionary = new Dictionary <GeoCoordinate, double>();

            foreach (GeoCoordinate coordinate in GeoCoordinates)
            {
                double calcDistance = (UserLocation.GetDistanceTo(coordinate) / 1609.344);
                if (Distance >= calcDistance && !coordDictionary.ContainsKey(coordinate))
                {
                    coordDictionary.Add(coordinate, calcDistance);
                }
            }

            response.Result = coordDictionary;

            return(response);
        }