In the project I'm working on, (.net Core) we are using a range slider (noUiSlider)to represent quality in a product filter.
The slider returns an array of numbers as an example [2, 4] would be returned if the slider was set to Good and Excellent and I would need to retrieve all the products that match Good, Very Good, and Excellent in quality.
Here in lies some of the unique problems with this. The products are pulled from a third party service, and I only receive the quality as the string value. So I need a way to assign a number value to the string value I receive so I can check for all products that have a quality >= to qualityArray[0] and <= to qualityArray[1]
What would be the best way to map between string to int so I can do the >= and <= check with the quality range and at the same time map the int to a string so when displaying the list of products that match the range I only have to display the string value? (Very Good)
I was imagining using an Enum or a Dictionary but I'm not sure what the advantages of either would be.