Esempio n. 1
0
        public async Task CreateGroupAssociationAsync([FromBody] GroupAssociationData groupData)
        {
            if (groupData == null)
            {
                throw new ArgumentNullException(nameof(groupData));
            }

            await this.groupAssociationDataRepository.CreateGroupAssociation(groupData);
        }
Esempio n. 2
0
        /// <summary>
        /// Create a new Group Association based on the GroupAssociation data.
        /// </summary>
        /// <param name="groupAssociationDataRepository">Group association repository.</param>
        /// <param name="draftGroupAssociationData">Group Association data received from the web interface.</param>
        /// <returns>A <see cref="Task"/> representing the result of the asynchronous operation.</returns>
        public static async Task CreateGroupAssociation(
            this IGroupAssociationDataRepository groupAssociationDataRepository,
            GroupAssociationData draftGroupAssociationData)
        {
            var tmpGroupAssociation = new GroupAssociationDataEntity
            {
                PartitionKey = GroupAssociationTableNames.GroupDataPartition,
                RowKey       = draftGroupAssociationData.GroupId,
                ChannelId    = draftGroupAssociationData.ChannelId,
                GroupName    = draftGroupAssociationData.GroupName,
                GroupId      = draftGroupAssociationData.GroupId,
                Email        = draftGroupAssociationData.GroupEmail,
            };

            await groupAssociationDataRepository.CreateOrUpdateAsync(tmpGroupAssociation);
        }
Esempio n. 3
0
        public async Task <IEnumerable <GroupAssociationData> > GetAllGroupsbyChannelIdAsync(string channelId)
        {
            var entities = await this.groupAssociationDataRepository.GetGroupAssociationByChannelId(channelId);

            var result = new List <GroupAssociationData>();

            foreach (var entity in entities)
            {
                var group = new GroupAssociationData
                {
                    GroupId    = entity.GroupId,
                    GroupEmail = entity.Email,
                    GroupName  = entity.GroupName,
                    ChannelId  = entity.ChannelId,
                };
                result.Add(group);
            }

            return(result);
        }