Beispiel #1
0
        // GET: /CreateRole
        public ActionResult CreateRole(string id)
        {
            //Get SystemUser
            SystemUser systemUser = new SystemUser();

            systemUser = systemUserRepository.GetUserBySystemUserGuid(id);

            //Check Exists
            if (systemUser == null)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(View("RecordDoesNotExistError"));
            }

            //AccessRights
            RolesRepository rolesRepository = new RolesRepository();

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


            ViewData["SystemUserName"] = (systemUser.LastName + ", " + systemUser.FirstName + " " + systemUser.MiddleName).Replace("  ", " ");


            ViewData["Roles"] =
                new SelectList((from s in systemUserRepository.GetUnUsedRoles(id).ToList()
                                select new { id = s.AdministratorRoleId + "_" + s.HierarchyLevelTypeId,
                                             Name = s.AdministratorRoleHierarchyLevelTypeName }
                                ), "id", "Name", null);

            //Show Create Form
            AdministratorRoleHierarchyLevelType administratorRoleHierarchyLevelType = new AdministratorRoleHierarchyLevelType();

            administratorRoleHierarchyLevelType.SystemUserGuid = systemUser.SystemUserGuid;
            return(View(administratorRoleHierarchyLevelType));
        }