Example #1
0
        public virtual async Task <IHttpActionResult> Subscribe(Guid groupId)
        {
            var currentMember = await _memberService.GetCurrentMemberAsync();

            var group = await _groupService.GetAsync(groupId);

            if (group == null || group.IsHidden)
            {
                return(NotFound());
            }

            if (await _groupMemberService.IsGroupMemberAsync(groupId, currentMember.Id))
            {
                await _groupMemberService.RemoveAsync(groupId, currentMember.Id);
            }
            else
            {
                var subscription = new GroupMemberSubscriptionModel
                {
                    MemberId = currentMember.Id,
                    IsAdmin  = false
                };

                await _groupMemberService.AddAsync(groupId, subscription);
            }

            return(Ok(_groupLinkProvider.GetGroupRoomLink(groupId)));
        }
Example #2
0
 private async Task InviteUser(MemberGroupInviteModel invite) =>
 await _groupMemberService.AddAsync(invite.GroupId, new GroupMemberSubscriptionModel
 {
     MemberId = invite.MemberId
 });