开发者

Ranking System with multiple boolean values

I have a List of service providers. Each service provider offers a different set of services. These services are represented in a SQL database as boolean values.

The user will determine which of these services they require from a service provider as search parameters (checkboxes) in the View. My goal is to return a list of service providers based on the user's selection and order theses service providers accordingly. Say the user wants 4 services, I want the service provi开发者_C百科ders with those 4 services to be on top, those with 3 of 4, next, and so on.

I'm having trouble thinking of the best way to do this. I'm using MVC2 with Linq.


You can select the service providers that has the services flag true putting these flags in an OR condition. When you select a service provider you can calculate the number of service flags that are true. So you have a list of new entities, every entity contains the service provider and the count of the flags setted as true. Now you can order this list by the flags count.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜