public static List <T> GetNearestFivePlaces(PlaceDao <T> collection, T p)
        {
            var places = (from place in collection.GetAllPlaces()
                          where place.Id != p.Id
                          select place).ToList();
            Dictionary <double, T> placesDistance = new Dictionary <double, T>();

            for (int i = 0; i < places.Count; i++)
            {
                double differ = DistancePoints(p.CoordinatesPlace, places[i].CoordinatesPlace);
                placesDistance.Add(differ, places[i]);
            }
            IEnumerable <T> result;

            if (placesDistance.Count < 5)
            {
                result = placesDistance.Values;
            }
            else
            {
                placesDistance.OrderBy(i => i.Key);
                result = placesDistance.Values.Take(5);
            }

            return(result.ToList <T>());
        }
        public static List <T> GetSameRatingPlaces(PlaceDao <T> collection, T p)
        {
            var result = from place in collection.GetAllPlaces()
                         where place.Rating == p.Rating && place.Id != p.Id
                         select place;

            return(result.ToList <T>());
        }
Exemple #3
0
        //
        // GET: /Restaurant/

        public ActionResult Index()
        {
            var result = restaurants.GetAllPlaces();

            return(View(result));
        }
Exemple #4
0
        //
        // GET: /Hotel/

        public ActionResult Index()
        {
            var result = hotels.GetAllPlaces();

            return(View(result));
        }
        //
        // GET: /GovenrmentBuilding/

        public ActionResult Index()
        {
            var result = governBuildings.GetAllPlaces();

            return(View(result));
        }
        //
        // GET: /Pharmacy/

        public ActionResult Index()
        {
            var result = pharmacies.GetAllPlaces();

            return(View(result));
        }