Esempio n. 1
0
        //
        // GET: /Route/

        public ActionResult ShowAllRoutes()
        {
            IRouteRepository routeRepository = new RouteRepository();
            var aggregatedRoutes             = routeRepository.GetAggregatedRoutes(50 * 1000); // w metrach
            var routes = routeRepository.getAllRoutes();
            List <POIModelExtended> RoutesList = new List <POIModelExtended>();
            POIModelExtended        routeToAdd;
            string place;

            //foreach(var route in routes)
            //{
            //    routeToAdd = new POIModel("", route.StartPoint, route.StartLat.GetValueOrDefault(), route.StartLong.GetValueOrDefault());
            //    RoutesList.Add(routeToAdd);
            //    routeToAdd = new POIModel("", route.EndPoint, route.EndLat.GetValueOrDefault(), route.EndLong.GetValueOrDefault());
            //    RoutesList.Add(routeToAdd);
            //}

            foreach (var route in aggregatedRoutes)
            {
                routeToAdd = new POIModelExtended("", route.StartName, route.StartLat, route.StartLong, route.Rate);
                RoutesList.Add(routeToAdd);
                routeToAdd = new POIModelExtended("", route.EndName, route.EndLat, route.EndLong, route.Rate);
                RoutesList.Add(routeToAdd);
            }

            return(View(RoutesList));
        }
Esempio n. 2
0
        public string getAllHeatPoint()
        {
            IRouteRepository routeRepository = new RouteRepository();
            List <Route>     allRoutes       = routeRepository.getAllRoutes();
            List <POIModel>  RoutesList      = new List <POIModel>();
            POIModel         routeToAdd;

            foreach (var route in allRoutes)
            {
                routeToAdd = new POIModel("", route.StartPoint, route.StartLat.GetValueOrDefault(), route.StartLong.GetValueOrDefault());
                RoutesList.Add(routeToAdd);
                routeToAdd = new POIModel("", route.EndPoint, route.EndLat.GetValueOrDefault(), route.EndLong.GetValueOrDefault());
                RoutesList.Add(routeToAdd);
            }

            return(JsonConvert.SerializeObject(RoutesList));
        }