예제 #1
0
 public ApiTripController(DBConnectionInfo dBConnectionInfo, string apiEndPoint) : base(dBConnectionInfo)
 {
     endPoint       = apiEndPoint;
     tripStore      = new TripStore(endPoint);
     tripPointStore = new TripPointStore(endPoint);
     poiStore       = new PoiStore(endPoint);
     userStore      = new UserStore(endPoint);
 }
 public ApiTripController(DBConnectionInfo dBConnectionInfo, string UserApiEndPoint, string PoiApiEndPoint, string TripsApiEndPoint) : base(dBConnectionInfo)
 {
     userApiEndPoint  = UserApiEndPoint;
     poiApiEndPoint   = PoiApiEndPoint;
     tripsApiEndPoint = TripsApiEndPoint;
     tripStore        = new TripStore(tripsApiEndPoint);
     tripPointStore   = new TripPointStore(tripsApiEndPoint);
     poiStore         = new PoiStore(poiApiEndPoint);
     userStore        = new UserStore(userApiEndPoint);
 }
        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));
        }
예제 #4
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));
        }
예제 #6
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));
        }
예제 #7
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);
        }