Exemple #1
0
            public static CustomerMember Create(Guid teamMemberId, string userId, string email, CustomerMemberRole role, string createdBy)
            {
                var entity = new CustomerMember()
                {
                    CustomerMemberId = teamMemberId,
                    UserId           = userId,
                    Email            = email,
                    Role             = role,
                    CreatedBy        = createdBy
                };

                var validationResult = new DataValidatorManager <CustomerMember>().Build().Validate(entity);

                if (!validationResult.IsValid)
                {
                    throw new ApplicationException(validationResult.Errors);
                }

                return(entity);
            }
Exemple #2
0
        public CustomerMember AddMember(Guid teamMemberId, string userId, string email, CustomerMemberRole role, string createdBy, bool activate = false)
        {
            if (this.Members == null)
            {
                this.Members = new List <CustomerMember>();
            }

            var newMember = CustomerMember.Factory.Create(teamMemberId, userId, email, role, createdBy);

            if (activate)
            {
                newMember.Activate();
            }

            this.Members.Add(newMember);

            return(newMember);
        }