Beispiel #1
0
        public ActionResult EditWmsLayer(int id)
        {
            var viewManager = new WmsLayersViewManager(GetCurrentUser(), SessionHandler.MySettings);
            WmsLayerEditorViewModel model = viewManager.CreateWmsLayerEditorViewModel(WmsLayerEditorMode.Edit, id);

            return(View("WmsLayerEditor", model));
        }
Beispiel #2
0
        /// <summary>
        /// Handle AddWmsLayer and EditWmsLayer Post.
        /// </summary>
        private ActionResult WmsLayerEditorPost(WmsLayerEditorMode mode, int?id, string data)
        {
            var viewManager                     = new WmsLayersViewManager(GetCurrentUser(), SessionHandler.MySettings);
            var javascriptSerializer            = new JavaScriptSerializer();
            WmsLayerViewModel wmsLayerViewModel = javascriptSerializer.Deserialize <WmsLayerViewModel>(data);

            if (ModelState.IsValid)
            {
                if (mode == WmsLayerEditorMode.Edit)
                {
                    viewManager.UpdateWmsLayer(id.Value, wmsLayerViewModel);
                }
                else
                {
                    viewManager.CreateNewWmsLayer(wmsLayerViewModel);
                }

                return(RedirectToAction("WmsLayers"));
            }
            WmsLayerEditorViewModel model = viewManager.CreateWmsLayerEditorViewModel(mode, id);

            return(View("WmsLayerEditor", model));
        }