示例#1
0
        //GET: Amigo/Closest
        public ActionResult Closest(string lati, string longi, string radium)
        {
            Amigo me = new Amigo();

            me.lati  = lati;
            me.longi = longi;
            if (radium.Contains(","))
            {
                radium = radium.Replace(",", ".");
            }
            double maxDistance = Double.Parse(radium, culture);

            List <Amigo> lista = new List <Amigo>();

            foreach (Amigo friend in db.Amigos)
            {
                if (me.getDistance(friend) <= maxDistance)
                {
                    lista.Add(friend);
                }
            }
            return(View(lista.ToList()));
        }