public DetailsUserModel GetUpdateModel(string userName)
        {
            var rolesForPage = new List <BaseRoleElement>();
            var roles        = IdentityRepository.GetAllRoles();
            var account      = IdentityRepository.GetUser(userName);
            var userRoles    = IdentityRepository.GetRolesForUser(userName);

            userRoles.ForEach(ur => rolesForPage.Add(new BaseRoleElement(ur, true)));
            roles.Except(userRoles).ForEach(role => rolesForPage.Add(new BaseRoleElement(role)));
            return(new DetailsUserModel(account.AccountName, account.Description, account.Email, account.Note, true, rolesForPage));
        }
        public DetailsRoleModel GetUpdateModel(string roleName)
        {
            var rolesForPage = new List <BaseRoleElement>();
            var allRoles     = IdentityRepository.GetAllRoles();

            allRoles.Remove(roleName);
            var baseRoles = IdentityRepository.GetRolesForRole(roleName);

            baseRoles.ForEach(role => rolesForPage.Add(new BaseRoleElement(role, true)));
            allRoles.Except(baseRoles).ForEach(role => rolesForPage.Add(new BaseRoleElement(role)));
            return(new DetailsRoleModel(roleName, true, rolesForPage));
        }
        public DetailsRoleModel GetNewModel()
        {
            var roles = IdentityRepository.GetAllRoles().Select(role => new BaseRoleElement(role)).ToList();

            return(new DetailsRoleModel(string.Empty, false, roles));
        }
Exemple #4
0
        public IdentityResponse GetAllRoles(BaseRequest request)
        {
            var data = IdentityRepository.GetAllRoles();

            return(new IdentityResponse(data));
        }
Exemple #5
0
        public TotalRolesModel GetAllRoles()
        {
            var roles = IdentityRepository.GetAllRoles();

            return(new TotalRolesModel(roles));
        }