Exemplo n.º 1
0
        public ActionResult EditCommonFolder(CommonFolderAssignment cfa, String submit, String editCommonFolderKey, String editCommonFolderVal)
        {
            DocumentsOperations docOps = new DocumentsOperations();
            AuthenticationsAndAuthorizationsOperations aNaOps = new AuthenticationsAndAuthorizationsOperations();

            switch (submit)
            {
            case "Add":
                if (String.Equals(editCommonFolderKey.ToUpper(), "USER"))
                {
                    docOps.InsertUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE"))
                {
                    docOps.InsertRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                break;

            case "Remove":
                if (String.Equals(editCommonFolderKey.ToUpper(), "USER"))
                {
                    docOps.RemoveUsersFilesAuthorizations(aNaOps.GetUserIDByUserName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                else if (String.Equals(editCommonFolderKey.ToUpper(), "ROLE"))
                {
                    docOps.RemoveRolesFilesAuthorizations(aNaOps.GetRoleIDByRoleName(editCommonFolderVal), docOps.GetFileIDByVirtualPath(cfa.VirtualPath));
                }
                break;
            }
            return(RedirectToAction("EditCommonFolder", new { virtualPath = cfa.VirtualPath }));
        }