示例#1
0
        /// <summary>
        /// Handle task module is submit.
        /// </summary>
        /// <param name = "turnContext" > The turn context.</param>
        /// <param name = "taskModuleRequest" >The task module invoke request value payload.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>A Task Module Response for the request.</returns>
        protected override async Task <TaskModuleResponse> OnTeamsTaskModuleSubmitAsync(ITurnContext <IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
        {
            var teamInfo = JObject.FromObject(taskModuleRequest.Data);
            var teamId   = (string)teamInfo.ToObject <ResponseData <string> >()?.TeamId;
            var userId   = (string)teamInfo.ToObject <ResponseData <string> >()?.UserId;
            var token    = string.Empty;

            _Token.TryGetValue("Token", out token);

            JoinTeamHelper.AddUserToTeam(token, teamId, userId);
            await turnContext.SendActivityAsync("User added to team successfully");

            return(null);
        }