コード例 #1
0
        // **************************************
        // UpdateCatalogRoleAllUsers
        // **************************************
        public static void UpdateAllUsers(int catalogId, int roleId)
        {
            using (var ctx = new SongSearchContext()) {
                var cat = ctx.Catalogs.SingleOrDefault(x => x.CatalogId == catalogId);

                if (cat != null) {
                    //var users = DataSession.GetObjectQuery<User>().Include("UserCatalogRoles").ToList();
                    var users = Account.User().MyUserHierarchy(true);

                    ctx.SetCatalogRole(catalogId, roleId, users);
                    ctx.SaveChanges();
                }
            }
        }