[HttpPost]//Reflection verileri ile oluşan ekrandan db aktarılacak veriler.
        public Result <int> SaveActionRoles([FromBody] SaveRoleActionsModel par)
        {
            return(this.ResultSingle(() =>
            {
                List <RoleControllerActionEntity> list = new List <RoleControllerActionEntity>(par.Data.Count());
                foreach (var node in par.Data)
                {
                    foreach (var childNode in node.children)                                                                           //Çünkü child note ile action lar kayıt edilmeli.
                    {
                        RoleControllerActionEntity entity = new RoleControllerActionEntity(par.RoleName, node.label, childNode.label); //role/controller/action
                        entity.Enabled = childNode.@checked;

                        list.Add(entity);
                    }
                }

                return SaveActionRoles(SqlRoleStorageProvider.Instance, list, AuthorizationValidator.Instance);
            }));
        }
示例#2
0
        public IEnumerable <RoleControllerActionEntity> GetAll()
        {
            List <RoleControllerActionEntity> list = new List <RoleControllerActionEntity>();

            using (var c = ionixFactory.CreateDbClient())
            {
                var rep  = new RoleRepository(c.Cmd);
                var view = rep.Select_V_RoleControllerAction();
                foreach (var item in view)
                {
                    if (!String.IsNullOrEmpty(item.ControllerName) && !String.IsNullOrEmpty(item.ActionName))
                    {
                        var entity = new RoleControllerActionEntity(item.RoleName, item.ControllerName, item.ActionName)
                        {
                            Enabled = item.Enabled ?? false
                        };

                        list.Add(entity);
                    }
                }
            }

            return(list);
        }