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))); }
private async Task InviteUser(MemberGroupInviteModel invite) => await _groupMemberService.AddAsync(invite.GroupId, new GroupMemberSubscriptionModel { MemberId = invite.MemberId });