Esempio n. 1
0
        public bool UpdateRoleMenu(RoleInfoEntity entity, long[] menuIds)
        {
            try
            {
                base.Update(entity.ID, entity);

                this.DB.Delete <RoleMenuInfoEntity>(x => x.RoleId == entity.ID);
                if (menuIds != null)
                {
                    RoleMenuInfoRepository repository = new RoleMenuInfoRepository();
                    foreach (var menuId in menuIds)
                    {
                        RoleMenuInfoEntity rmEntity = new RoleMenuInfoEntity();
                        rmEntity.RoleId = entity.ID;
                        rmEntity.MenuId = menuId;
                        repository.Add(rmEntity);
                    }
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Esempio n. 2
0
        public bool SetRoleMenu(RoleInfoEntity entity, long[] menuIds)
        {
            base.Add(entity);
            if (entity.ID > 0)
            {
                RoleMenuInfoRepository repository = new RoleMenuInfoRepository();
                foreach (var menuId in menuIds)
                {
                    RoleMenuInfoEntity rmEntity = new RoleMenuInfoEntity();
                    rmEntity.RoleId = entity.ID;
                    rmEntity.MenuId = menuId;
                    repository.Add(rmEntity);
                }

                return(true);
            }

            return(false);
        }