Пример #1
0
 internal static string GetGoogleEarthUrl(GoogleEarthModel model)
 {
     return
         (string.Format(
              "http://maps.google.com/maps?q={0},+{1},+{2},+{3},+United+States,+{4}&maptype=hybrid&sensor=false&output=embed",
              string.IsNullOrEmpty(model.Name) ? "" : model.Name.Replace(" ", "+"),
              string.IsNullOrEmpty(model.Address)? "" :  model.Address.Replace(" ", "+"),
              string.IsNullOrEmpty(model.City) ? "" : model.City.Replace(" ", "+"), model.State, model.Zip));
 }
Пример #2
0
        public void GetGoogleEarthUrlTest()
        {
            var list = new List <string> {
                "1", "2", "3"
            };

            list.ToString();

            GoogleEarthModel model    = null;         // TODO: Initialize to an appropriate value
            string           expected = string.Empty; // TODO: Initialize to an appropriate value
            string           actual;

            actual = UrlHelper.GetGoogleEarthUrl(model);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Пример #3
0
        internal static string GetGoogleEarthUrl(GoogleEarthModel model)
        {
            var builder = new StringBuilder("https://maps.google.com/maps?q=");

            if (!string.IsNullOrEmpty(model.Name))
            {
                builder.Append(model.Name.Replace(" ", "+"));
            }

            if (!string.IsNullOrEmpty(model.Address))
            {
                builder.Append(",+");
                builder.Append(model.Address.Replace(" ", "+"));
            }

            if (!string.IsNullOrEmpty(model.City))
            {
                builder.Append(",+");
                builder.Append(model.City.Replace(" ", "+"));
            }

            if (!string.IsNullOrEmpty(model.State))
            {
                builder.Append(",+");
                builder.Append(model.State.Replace(" ", "+"));
            }

            builder.Append(",+United+States");
            if (!string.IsNullOrEmpty(model.Zip))
            {
                builder.Append(",+");
                builder.Append(model.Zip.Replace(" ", "+"));
            }

            builder.Append("&maptype=hybrid&sensor=false&output=embed");


            return(builder.ToString());
        }
Пример #4
0
        public ActionResult Earth(GoogleEarthModel googleEarthModel)
        {
            ViewBag.Url = Helpers.UrlHelper.GetGoogleEarthUrl(googleEarthModel);

            return(View());
        }