예제 #1
0
        public SingleModelResponse<Route> SaveRoute(RouteViewModel mapRoute,string userId)
        {
            string MapUrl = MapUri + "AddRoute?userId="+userId;
            List<Checkpoint> newCheckPoints = new List<Checkpoint>();
            foreach (CheckpointViewModel check in mapRoute.Checkpoints)
            {
                Checkpoint checkPoint = new Checkpoint();
                checkPoint.Latitude = check.Latitude;
                checkPoint.Longitude = check.Longitude;
                newCheckPoints.Add(checkPoint);
            }

            var newRoute = new Route
            {
                UserID = mapRoute.UserID,
                Title = mapRoute.Title,
                Distance = mapRoute.TotalDistance,
                Checkpoint = newCheckPoints
            };
            var createdRoute = PostContent(MapUrl, newRoute);
            return createdRoute;
        }
예제 #2
0
 public HomeViewModel(EventViewModel[] evnts,RouteViewModel[] routes)
 {
     Events = evnts;
     Routes = routes;
 }
예제 #3
0
        public SingleModelResponse<Route> UpdateRoute(RouteViewModel mapRoute)
        {
            string MapUrl = MapUri + "Update/EditRoute";
            List<Checkpoint> newCheckPoints = new List<Checkpoint>();
            foreach (CheckpointViewModel check in mapRoute.Checkpoints)
            {
                Checkpoint checkPoint = new Checkpoint();
                checkPoint.Latitude = check.Latitude;
                checkPoint.Longitude = check.Longitude;
                newCheckPoints.Add(checkPoint);
            }

            var newRoute = new Route
            {
                RouteId = mapRoute.RouteId,
                UserID = mapRoute.UserID,
                Title = mapRoute.Title,
                Distance = mapRoute.TotalDistance,
                Checkpoint = newCheckPoints
            };
            var createdRoute = PutContent(MapUrl, newRoute);
            return createdRoute;
        }