Exemplo n.º 1
0
 /// <summary>
 /// 添加组
 /// </summary>
 /// <param name="groupName">组名</param>
 /// <returns>返回添加结果</returns>
 public static CreateGroupResult CreateUserGroup(string groupName)
 {
    return AccessToken.ApiHandlerWapper.TryCommonApi<CreateGroupResult>(accessToken =>
    {
        CreateGroup data = new CreateGroup
        {
            group = new UserGroup
            {
                name = groupName
            }
        };
        // var data = new { group = group };
        return CommonSend.Send<CreateGroupResult>(AccessToken.AccessTokenHelper.AccessToken, UserGroupApi.CreateGroup_Url, data);
    });
 }
Exemplo n.º 2
0
        /// <summary>
        /// 根据分组id,新的分组名称修改分组名
        /// </summary>
        /// <param name="groupId"></param>
        /// <param name="newGroupName"></param>
        /// <returns></returns>
        public RequestErrorResult UpdateGroupName(int groupId, string newGroupName)
        {
            return AccessToken.ApiHandlerWapper.TryCommonApi<RequestErrorResult>(accessToken =>
            {
                CreateGroup updateGroup = new CreateGroup
                {
                    group = new UserGroup
                    {
                        id = groupId,
                        name = newGroupName
                    }
                };

                return CommonSend.Send<RequestErrorResult>(accessToken, UserGroupApi.UpdateGroup_Url, updateGroup);
            });
        }