public PartialViewResult RenderMap()
        {
            var teamendpoint = Configuration.GetValue <string>("TRIPS_ROOT_URL");
            //Get trips
            TripStore   t     = new TripStore(_clientFactory, teamendpoint);
            List <Trip> trips = t.GetItemsAsync().Result;
            //Get Last Trip
            var last  = trips.Max(trip => trip.RecordedTimeStamp);
            var tlast = from Trip latest in trips
                        where latest.RecordedTimeStamp == last
                        select latest;
            //Get TripPoints
            TripPointStore   tps        = new TripPointStore(_clientFactory, teamendpoint);
            List <TripPoint> tripPoints = tps.GetItemsAsync(tlast.First()).Result;


            return(PartialView(tripPoints));
        }
Esempio n. 2
0
        public PartialViewResult RenderMap()
        {
            var teamendpoint = _envvars.TRIPS_API_ENDPOINT;
            //Get trips
            TripStore   t     = new TripStore(teamendpoint);
            List <Trip> trips = t.GetItemsAsync().Result;
            //Get Last Trip
            var last  = trips.Max(trip => trip.RecordedTimeStamp);
            var tlast = from Trip latest in trips
                        where latest.RecordedTimeStamp == last
                        select latest;
            //Get TripPoints
            TripPointStore   tps        = new TripPointStore(teamendpoint);
            List <TripPoint> tripPoints = tps.GetItemsAsync(tlast.First()).Result;


            return(PartialView(tripPoints));
        }
        public IActionResult Index()
        {
            var teamendpoint = Configuration.GetValue <string>("TRIPS_ROOT_URL");
            var bingMapsKey  = Configuration.GetValue <string>("BING_MAPS_KEY");

            //Get trips
            TripStore   t     = new TripStore(_clientFactory, teamendpoint);
            List <Trip> trips = t.GetItemsAsync().Result;
            //Get Last Trip
            var last  = trips.Max(trip => trip.RecordedTimeStamp);
            var tlast = from Trip latest in trips
                        where latest.RecordedTimeStamp == last
                        select latest;
            //Get TripPoints
            TripPointStore   tps        = new TripPointStore(_clientFactory, teamendpoint);
            List <TripPoint> tripPoints = tps.GetItemsAsync(tlast.First()).Result;

            ViewData["MapKey"] = bingMapsKey;
            return(View(tripPoints));
        }
Esempio n. 4
0
        public IActionResult Index()
        {
            var teamendpoint = _envvars.TRIPS_API_ENDPOINT;
            var bingMapsKey  = _envvars.BING_MAPS_KEY;

            //Get trips
            TripStore   t     = new TripStore(teamendpoint);
            List <Trip> trips = t.GetItemsAsync().Result;
            //Get Last Trip
            var last  = trips.Max(trip => trip.RecordedTimeStamp);
            var tlast = from Trip latest in trips
                        where latest.RecordedTimeStamp == last
                        select latest;
            //Get TripPoints
            TripPointStore   tps        = new TripPointStore(teamendpoint);
            List <TripPoint> tripPoints = tps.GetItemsAsync(tlast.First()).Result;

            ViewData["MapKey"] = bingMapsKey;
            return(View(tripPoints));
        }
Esempio n. 5
0
        private List <TripPoint> getRandomTripPoints()
        {
            var teamendpoint = _envvars.TRIPS_API_ENDPOINT;

            //Get trips
            TripStore   t     = new TripStore(teamendpoint);
            List <Trip> trips = t.GetItemsAsync().Result;

            if (trips.Count == 0)
            {
                return(new List <TripPoint>());
            }

            //Get Random Trip
            var  r          = new Random();
            Trip randomTrip = trips.ElementAt(r.Next(0, trips.Count()));

            //Get TripPoints
            TripPointStore tps = new TripPointStore(teamendpoint);

            return(tps.GetItemsAsync(randomTrip).Result);
        }