Exemple #1
0
        public void AddGroup(Group group, GroupMemberService groupMemberService)
        {
            AssertionConcern.AssertArgumentNotNull(group, "Group must not be null.");
            AssertionConcern.AssertArgumentEquals(this.TenantId, group.TenantId, "Wrong tenant for this group.");
            AssertionConcern.AssertArgumentFalse(groupMemberService.IsMemberGroup(group, this.ToGroupMember()), "Group recurrsion.");

            if (this.GroupMembers.Add(group.ToGroupMember()) && (!this.IsInternalGroup))
            {
                DomainEventPublisher
                .Instance
                .Publish(new GroupGroupAdded(
                             this.TenantId,
                             this.Name,
                             group.Name));
            }
        }