public async Task <ActionResult <ICollection <UserGroupInfo> > > EvaluateCustomer(string customerId) { ICollection <UserGroupInfo> result = Array.Empty <UserGroupInfo>(); var member = await _memberService.GetByIdAsync(customerId, (MemberResponseGroup.WithDynamicProperties | MemberResponseGroup.WithGroups).ToString(), typeof(Contact).Name); if (member is Contact customer) { var evaluationContext = new UserGroupEvaluationContext { Customer = customer }; result = await _userGroupEvaluator.EvaluateUserGroupsAsync(evaluationContext); } return(Ok(result)); }
protected override async Task <IndexDocument> CreateDocument(Member member) { var document = await base.CreateDocument(member); if (member is IHasSecurityAccounts hasSecurityAccounts) { document.AddFilterableAndSearchableValues("Stores", hasSecurityAccounts.SecurityAccounts.Select(x => x.StoreId).ToArray()); } if (member is Contact customer) { var evaluationContext = new DemoUserGroupEvaluationContext { Customer = customer }; document.AddFilterableValues("Groups", await _userGroupEvaluator.EvaluateUserGroupsAsync(evaluationContext)); } return(document); }