Exemplo n.º 1
0
        /// <summary>
        /// Extracts tracks from an existing trail for editing
        /// </summary>
        public ActionResult Modify(string id, TrailViewModel.MergeConfirmTypes confirm = TrailViewModel.MergeConfirmTypes.Intent)
        {
            var edits = _trackEditService.ListTracks().Count;

            if (edits > 0)
            {
                if (confirm == TrailViewModel.MergeConfirmTypes.Intent)
                {
                    // show confirmation message
                    var model = InitModel(id);
                    model.ErrorMessages.Add(edits.ToString());
                    return(View(model));
                }
                else if (confirm == TrailViewModel.MergeConfirmTypes.Discard)
                {
                    // discard existing
                    _trackEditService.RemoveAll();
                }
            }

            // perform track extracts
            var uri = _topoTrailService.GetTrailUri(id);

            _trackEditService.CreateTracks(uri);

            // cache trail level data
            var trail = _topoTrailService.GetTrail(id);

            _editing = trail;

            // go to track manage page
            return(Redirect(TrackViewModel.GetManageUrl()));
        }
Exemplo n.º 2
0
        private TrackViewModel InitModel()
        {
            var model = new TrackViewModel();

            model.Tracks = _trackEditService.ListTracks();

            return(model);
        }