Exemple #1
0
        public ActionResult DeleteRole(int administratorRoleId, int hierarchyLevelTypeId, string id, string languageCode)
        {
            //Check Exists
            AdministratorRoleHierarchyLevelTypeSystemUser administratorRoleHierarchyLevelTypeSystemUser = new AdministratorRoleHierarchyLevelTypeSystemUser();

            administratorRoleHierarchyLevelTypeSystemUser = systemUserRepository.GetUserRole(administratorRoleId, hierarchyLevelTypeId, id);
            if (administratorRoleHierarchyLevelTypeSystemUser == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToSystemUserRoles(administratorRoleHierarchyLevelTypeSystemUser.SystemUserGuid))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Add Linked Tables
            systemUserRepository.EditUserRoleForDisplay(administratorRoleHierarchyLevelTypeSystemUser);

            //Get SystemUser
            SystemUser systemUser = new SystemUser();

            systemUser = systemUserRepository.GetUserBySystemUserGuid(id);

            ViewData["Name"] = (systemUser.LastName + ", " + systemUser.FirstName + " " + systemUser.MiddleName).Replace("  ", " ");
            return(View(administratorRoleHierarchyLevelTypeSystemUser));
        }