コード例 #1
0
        /// <summary>
        /// Delete a list of users from a community group
        /// </summary>
        /// <param name="groupShortName">Short name of the group</param>
        /// <param name="members">List users that want to add</param>
        public void DeleteMembersFromGroup(string groupShortName, List <Guid> members)
        {
            try
            {
                string url = $"{ApiUrl}/community/delete-members-of-community-group";

                MembersGroupCommunityModel model = new MembersGroupCommunityModel()
                {
                    community_short_name = CommunityShortName, group_short_name = groupShortName, members = members
                };

                WebRequestPostWithJsonObject(url, model);

                Log.Debug($"The users has been deleted from the group {groupShortName} of the communtiy {CommunityShortName}");
            }
            catch (Exception ex)
            {
                Log.Error($"Error deleting users {string.Join(",", members)} from group {groupShortName} of the community {CommunityShortName}: \r\n{ex.Message}");
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// Add a list of users to a community group
        /// </summary>
        /// <param name="groupShortName">Short name of the group</param>
        /// <param name="members">List users that want to add</param>
        /// <param name="sendNotification">It indicates whether a massage is going to be sent to users telling them has been added to the group</param>
        public void AddMembersToGroup(string groupShortName, List <Guid> members, bool sendNotification = false)
        {
            string miembros = string.Empty;

            try
            {
                string url = $"{ApiUrl}/community/add-members-to-community-group";

                MembersGroupCommunityModel model = new MembersGroupCommunityModel()
                {
                    community_short_name = CommunityShortName, group_short_name = groupShortName, members = members, send_notification = sendNotification
                };

                WebRequestPostWithJsonObject(url, model);

                Log.Debug($"The users has been added to the group {groupShortName} of the communtiy {CommunityShortName}");
            }
            catch (Exception ex)
            {
                Log.Error($"Error adding users {string.Join(",", members)} to group {groupShortName} of the community {CommunityShortName}: \r\n{ex.Message}");
                throw;
            }
        }