Example #1
0
        /// <summary>
        /// Add channel data in Table Storage.
        /// </summary>
        /// <param name="teamDataRepository">The team data repository.</param>
        /// <param name="activity">Bot conversation update activity instance.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        public static async Task SaveTeamDataAsync(
            this TeamDataRepository teamDataRepository,
            IConversationUpdateActivity activity)
        {
            var teamDataEntity = TeamDataRepositoryExtensions.ParseTeamData(activity);

            if (teamDataEntity != null)
            {
                await teamDataRepository.CreateOrUpdateAsync(teamDataEntity);
            }
        }
Example #2
0
        /// <summary>
        /// Remove channel data in table storage.
        /// </summary>
        /// <param name="teamDataRepository">The team data repository.</param>
        /// <param name="activity">Bot conversation update activity instance.</param>
        /// <returns>A task that represents the work queued to execute.</returns>
        public static async Task RemoveTeamDataAsync(
            this TeamDataRepository teamDataRepository,
            IConversationUpdateActivity activity)
        {
            var teamDataEntity = TeamDataRepositoryExtensions.ParseTeamData(activity);

            if (teamDataEntity != null)
            {
                var found = await teamDataRepository.GetAsync(TeamDataTableNames.TeamDataPartition, teamDataEntity.TeamId);

                if (found != null)
                {
                    await teamDataRepository.DeleteAsync(found);
                }
            }
        }