Example #1
0
        public ActionResult Delete(int key, int projectId)
        {
            if (!CanManageProject(projectId))
            {
                return(JsonNoPermissions());
            }

            ProjectDocumentManager.Delete(key);

            return(JsonSuccess(null));
        }
Example #2
0
        public ActionResult DeleteDocument(int documentId, int projectId)
        {
            if (!CanManageProject(projectId))
            {
                return(JsonNoPermissions());
            }

            var documentDto = ProjectDocumentManager.Get(documentId);

            if (documentDto != null)
            {
                ProjectDocumentManager.Delete(documentId);

                return(JsonSuccess(new { id = documentId }));
            }

            return(JsonError("Unable to find file"));
        }
Example #3
0
        public ActionResult DeleteFolder(int folderId, int projectId)
        {
            if (!CanManageProject(projectId))
            {
                return(JsonNoPermissions());
            }

            var documentDto = ProjectDocumentManager.Get(folderId);

            if (documentDto != null)
            {
                if (!documentDto.Entity.IsFolder)
                {
                    throw new ValidationException("Not a folder");
                }

                ProjectDocumentManager.Delete(folderId);

                return(JsonSuccess(new { id = folderId }));
            }

            return(JsonError("Unable to find folder"));
        }