예제 #1
0
 // GET: Map/Delete/5
 public ActionResult Delete(string id, string currFolderID)
 {
     try
     {
         _currentFolderID = currFolderID;
         var map = _mapManager.GetMapById(new ObjectId(id));
         if (IsValidId(id) && IsValidMap(map) && _mapManager.IsMapOwner(map.Id.ToString(), User.Identity.GetUserId()))
         {
             var mdvm = new MapDeleteViewModel {
                 Id = map.Id.ToString(), Name = map.Name, CreatorEmail = UserManager.GetEmail(map.Creator.ToString()), CreationTime = map.CreationTime, Description = map.Description
             };
             return(View(mdvm));
         }
     }
     catch (Exception)
     {
         return(RedirectToAction("Index", "Home"));
     }
     return(RedirectToAction("Index", "Home"));
 }
예제 #2
0
        public ActionResult Delete(MapDeleteViewModel model)
        {
            try
            {
                ObjectId mapID = new ObjectId(model.Id);
                _mapManager.RemoveMap(mapID);

                foreach (var f in _folderManeger.GetAllFolders())
                {
                    if (f.idOfMapsInFolder.Contains(mapID))
                    {
                        f.idOfMapsInFolder.Remove(mapID);
                        _folderManeger.UpdateMapFolder(f);
                    }
                }

                return(RedirectToAction("Index", "Home"));
            }
            catch
            {
                return(View());
            }
        }
 public ActionResult Delete(string id)
 {
     try
     {
         // deleteFolder(id);
         ViewBag.folderID = id;
         var folder = new MapFolderDB(new Settings()).GetMapFolderById(new ObjectId(id));
         ViewBag.prevFolderID = folder.ParentDierctory.ToString();
         var map = this._mapFolderDataManager.GetMapFolderById(new ObjectId(id));
         if (IsValidId(id) && IsValidMap(map))
         {
             var mdvm = new MapDeleteViewModel {
                 Id = map.Id.ToString(), Name = map.Name, CreatorEmail = "", CreationTime = map.CreationTime, Description = map.Description
             };
             return(View(mdvm));
         }
     }
     catch (Exception)
     {
         return(RedirectToAction("Index", "Home"));
     }
     return(RedirectToAction("Index", "Home"));
 }
예제 #4
0
        public ActionResult MapDelete(TreatmentBMPPrimaryKey treatmentBMPPrimaryKey, MapDeleteViewModel viewModel)
        {
            var treatmentBMP             = treatmentBMPPrimaryKey.EntityObject;
            var delineation              = treatmentBMP.Delineation;
            var isDelineationDistributed = delineation?.DelineationType == DelineationType.Distributed;
            var geometry = delineation?.DelineationGeometry;

            if (delineation == null)
            {
                throw new SitkaRecordNotFoundException(
                          $"No delineation found for Treatment BMP {treatmentBMPPrimaryKey}");
            }

            delineation.DeleteDelineation(HttpRequestStorage.DatabaseEntities);

            if (isDelineationDistributed)
            {
                ModelingEngineUtilities.QueueLGURefreshForArea(geometry, null);
            }

            SetMessageForDisplay("The Delineation was successfully deleted.");

            return(Json(new { success = true }));
        }