public void AddUserInvitation(OrganizationUserInvitation organizationUserInvitation) { if (this.UserInvitations == null) { this.UserInvitations = new List <OrganizationUserInvitation>(); } this.UserInvitations.Add(organizationUserInvitation); }
public static OrganizationUserInvitation Create(Guid organizationId, string userId, string userEmail, PipelineRole role, string createdBy) { var entity = new OrganizationUserInvitation() { OrganizationId = organizationId, UserId = userId, UserEmail = userEmail, InvitationType = string.IsNullOrEmpty(userId) ? UserInvitationType.ExternalUser : UserInvitationType.InternalUser, Role = role, InvitationStatus = UserInvitationStatus.Pending, CreatedBy = createdBy, Status = EntityStatus.Active }; var validationResult = new DataValidatorManager <OrganizationUserInvitation>().Build().Validate(entity); if (!validationResult.IsValid) { throw new ApplicationException(validationResult.Errors); } return(entity); }