コード例 #1
0
        public ActionResult GetDirections(string startPostCode, string endPostCode)
        {
            var xx = _googleDirectionsServiceClient.GetDirectionsBetweenPostcodesAsXml("AL6", "lu7");

            IList <DirectionStep> steps = new List <DirectionStep>();

            foreach (var route in xx.Routes)
            {
                foreach (var leg in route.Legs)
                {
                    foreach (var step in leg.Steps)
                    {
                        var directionStep = new DirectionStep();
                        directionStep.Distance = step.Distance.Text;
                        directionStep.Duration = step.Duration.Text;
                        directionStep.HtmlText = step.HtmlDirections;
                        steps.Add(directionStep);
                    }
                }
            }
            return(View(steps));
        }
コード例 #2
0
 public DirectionsRoute GetDirections(string startPostCode, string endPostCode)
 {
     return(_googleDirectionsServiceClient.GetDirectionsBetweenPostcodesAsXml(startPostCode, endPostCode));
 }