/// <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); } }
/// <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(PartitionKeyNames.TeamDataTable.TeamDataPartition, teamDataEntity.TeamId); if (found != null) { await teamDataRepository.DeleteAsync(found); } } }