Filter functionality Project using C#
Let me focus on the Filter method.

There are a lot of repetitions in that method, which makes your code

harder to maintain

for example: replacing IndexOf to Equals
or by changing the StringComparison option to another


and more error-prone

for example: it is easy to misspell the All at one of the occurrences.





There are a couple of useful techniques that can make your code less error-prone and easier to change:

Using constants, like: const string all = &quot;All&quot;;
Using single return, like: return concessionList.Where(predicate).ToList();
Extracting common logic, like:

static bool IsPresent(string source, string target)
   =&gt; source.IndexOf(target, StringComparison.InvariantCultureIgnoreCase) &gt;= 0;


Using default values instead of fallback,

like: predicate can have default value instead of relying on a
final else block.



With these in our hand the Filter method could be rewritten like this:
private List&lt;ConcessionModel&gt; Filter(string product, string category, string status)
{
    const string all = &quot;All&quot;;

    static bool IsPresent(string source, string target) 
        =&gt; source.IndexOf(target, StringComparison.InvariantCultureIgnoreCase) &gt;= 0;

    Func&lt;ConcessionModel, bool&gt; predicate = model =&gt;
        IsPresent(model.Product, product) &amp;&amp;
        IsPresent(model.Category, category) &amp;&amp; 
        IsPresent(model.Status, status);

    if (category == all &amp;&amp; status != all)
    {
        predicate = model =&gt;
            IsPresent(model.Product, product) &amp;&amp;
            IsPresent(model.Status, status);
    }
    else if (category != all &amp;&amp; status == all)
    {
        predicate = model =&gt;
            IsPresent(model.Product, product) &amp;&amp;
            IsPresent(model.Category, category);
    }
    else if (category == all &amp;&amp; status == all)
    {
        predicate = model =&gt;
            IsPresent(model.Product, product);
    }
    
    return concessionList.Where(predicate).ToList();
}


predicate: I've defined a function variable (Func&lt;TInput, TOutput&gt;)

It receives a ConcessionModel (as TInput)
and will return with a bool (as TOutput).


So, I have defined a function which implementation varies based on the input parameters.
We use this function as a filter condition (Where) against the data source (concessionList)

Here I have used the short form, but could be written like this:

return concessionList.Where(model =&gt; predicate(model)).ToList();