Beispiel #1
0
        public ActionResult Index(int?tripId, bool viewRawLocation = false)
        {
            ViewBag.Title = "Home Page";

            TripPathViewModel model = new TripPathViewModel();

            model.ViewRawLocation = viewRawLocation;
            model.Trips           = service.GetAllTrips();
            model.ManualAnomalies = anomalyService.GetAllManualAnomalies().Select(a => new ManualAnomalyViewModel()
            {
                Id               = a.Id,
                CreationDate     = a.CreationDate.ToString(),
                SnappedLatitude  = a.SnappedLatitude,
                SnappedLongitude = a.SnappedLongitude,
                Type             = a.Type,
                SegmentId        = a.SegmentId
            }).ToList();

            if (tripId != null && tripId.HasValue)
            {
                model.Measurements = service.GetTripMeasuremnts(tripId.Value).Select(a => new MeasurementViewModel()
                {
                    Id = a.Id,
                    MeasurementTime  = a.MeasurementTime.ToString(),
                    SnappedLatitude  = a.SnappedLatitude,
                    SnappedLongitude = a.SnappedLongitude,
                    Latitude         = a.Latitude,
                    Longitude        = a.Longitude,
                    SegmentId        = a.SegmentId
                }).ToList();
            }

            return(View(model));
        }
Beispiel #2
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            HomeModel model = new HomeModel();

            model.ManualAnomalies = service.GetAllManualAnomalies().Select(a => new ManualAnomalyViewModel()
            {
                Id               = a.Id,
                CreationDate     = a.CreationDate.ToString(),
                SnappedLatitude  = a.SnappedLatitude,
                SnappedLongitude = a.SnappedLongitude,
                Type             = a.Type,
                SegmentId        = a.SegmentId
            });
            return(View(model));
        }
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";


            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            serializer.MaxJsonLength = Int32.MaxValue;



            SegmentViewModel model = new SegmentViewModel();

            var segments = service.GetAllSegments().Select(a => new SegmentModel()
            {
                Id            = a.Id,
                Latitude      = a.Latitude,
                Longitude     = a.Longitude,
                NextSegmentId = a.NextSegmentId,
                speedAvg      = a.speedAvg,
                AvgSpentTime  = a.AvgSpentTime,
                speedVar      = a.speedVar,
                VarSpentTime  = a.VarSpentTime,
                samplesCount  = a.samplesCount
            }).ToList();

            var segmentsJson = serializer.Serialize(segments);

            model.SegmentsJson    = segmentsJson;
            model.AnomaliesCount  = anomalyService.GetAnomalyCount();
            model.ManualAnomalies = anomalyService.GetAllManualAnomalies().Select(a => new ManualAnomalyViewModel()
            {
                Id               = a.Id,
                CreationDate     = a.CreationDate.ToString(),
                SnappedLatitude  = a.SnappedLatitude,
                SnappedLongitude = a.SnappedLongitude,
                Type             = a.Type,
                SegmentId        = a.SegmentId
            }).ToList();


            return(View(model));
        }