Customer List Generation

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 6 ans
Hello,

I am looking at the customer list and can see that the default list display is show all registered users.

Is there any way I can alter this part of the query in the CustomerService.cs file to exclude the registered users which also have the administrators role.

query = query.Where(c => c.CustomerRoles.Select(cr => cr.Id).Intersect(customerRoleIds).Any());

I am new to asp.net MVC and still trying to get my head around it.

Thanks,

Andy
Il y a 6 ans
andrewhuk41 wrote:
Hello,

I am looking at the customer list and can see that the default list display is show all registered users.

Is there any way I can alter this part of the query in the CustomerService.cs file to exclude the registered users which also have the administrators role.

query = query.Where(c => c.CustomerRoles.Select(cr => cr.Id).Intersect(customerRoleIds).Any());

I am new to asp.net MVC and still trying to get my head around it.

Thanks,

Andy



You have to compare with Role Id .. first try to know the admin role id and Registered id.

And then compare with these ids as your desired condition.

Can use GetCustomerBySystemName(string systemName) this method for knowing role id.
Il y a 6 ans
Hi,

Thanks for your reply..

Registered User is ID 3 and the Administrators ID is 1

I know the default role ID for when the customer page first loads is using ID3, which is find to list all the registered users. What I am after is to filter out the administrators from all the registered user records pulled.

I hope you understand what I am trying to achieve?

Thanks,

Andy
Il y a 6 ans
andrewhuk41 wrote:
Hi,

Thanks for your reply..

Registered User is ID 3 and the Administrators ID is 1

I know the default role ID for when the customer page first loads is using ID3, which is find to list all the registered users. What I am after is to filter out the administrators from all the registered user records pulled.

I hope you understand what I am trying to achieve?

Thanks,

Andy


Try ==>


query = query.Where(c => c.CustomerRoles.Any(cr => cr.Id==3) && !c.CustomerRoles.Any(cr => cr.Id==1));
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.