コード例 #1
0
        public static void AddUserToGroup(UserInfo userInfo, GroupInfo groupInfo)
        {
            var user = GetUserWithEmail(userInfo.Email);
            var ug   = new UserGroup();

            ug.GroupId = groupInfo.Id;
            ug.UserId  = user.Id;
            UserGroupBL.AddUserGroup(ug);
        }
コード例 #2
0
        public static void RemoveUserFromGroup(UserInfo userInfo, GroupInfo groupInfo)
        {
            var user = GetUserWithEmail(userInfo.Email);
            var ug   = user.UserGroups.ToList().Find(ug => ug.GroupId == groupInfo.Id);

            UserGroupBL.RemoveUserGroup(ug);
            var group = GroupBL.GetGroup(groupInfo.Id);

            if (GroupBL.isEmpty(group))
            {
                GroupBL.RemoveGroup(group);
            }
        }