title: Mutliple Criteria query in Asp.net Mvc 3 / C#
body: <p>i am using asp.net mvc3 and i am going to implement advance search<br>
  this is my advance search form </p>
  
  <pre><code> @using (Html.BeginForm("AdvanceSearch","Coupon",FormMethod.Post))
      {
          @Html.ValidationSummary(true)
          &lt;fieldset&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.CouponName)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.AdvanceSearch.CouponName)
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.CouponName)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.Category)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.DropDownList("categories", new SelectList(Model.AdvanceSearch.Category.OrderBy(c=&gt;c.Name).Select(c =&gt; c.Name)), "--- Select Categories ---")
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.Category)
              &lt;/div&gt;
              &lt;div class="editor-label"&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.LabelFor(model =&gt; model.AdvanceSearch.CreateDate)
                  &lt;/div&gt;
                  &lt;div class="editor-field"&gt;
                      @Html.EditorFor(model =&gt; model.AdvanceSearch.CreateDate, new { @class = "picker" })
                      @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.CreateDate)
                  &lt;/div&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.LabelFor(model =&gt; model.AdvanceSearch.ExpiredDate)
                  &lt;/div&gt;
                  &lt;div class="editor-field"&gt;
                      @Html.EditorFor(model =&gt; model.AdvanceSearch.ExpiredDate, new { @class = "picker" })
                      @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.ExpiredDate)
                  &lt;/div&gt;
  
                  &lt;div class="editor-label"&gt;
                      @Html.LabelFor(model =&gt; model.AdvanceSearch.PublishDate)
                  &lt;/div&gt;
                  &lt;div class="editor-field"&gt;
                      @Html.EditorFor(model =&gt; model.AdvanceSearch.PublishDate, new { @class = "picker" })
                      @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.PublishDate)
                  &lt;/div&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.Company)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.DropDownList("companies", new SelectList(Model.AdvanceSearch.Company.OrderBy(c=&gt;c.Name).Select(c =&gt; c.Name)), "--- Select Companies ---")
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.Company)
              &lt;/div&gt;
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.Description)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.AdvanceSearch.Description)
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.Description)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.IsPublish)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.AdvanceSearch.IsPublish)
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.IsPublish)
              &lt;/div&gt;
  
              &lt;div class="editor-label"&gt;
                  @Html.LabelFor(model =&gt; model.AdvanceSearch.Active)
              &lt;/div&gt;
              &lt;div class="editor-field"&gt;
                  @Html.EditorFor(model =&gt; model.AdvanceSearch.Active)
                  @Html.ValidationMessageFor(model =&gt; model.AdvanceSearch.Active)
              &lt;/div&gt;
  
              &lt;p&gt;
                  &lt;input type="submit" value="Search" /&gt;
              &lt;/p&gt;
          &lt;/fieldset&gt;
      }
  </code></pre>
  
  <p>now the problem is that i have following scenarios</p>
  
  <ul>
  <li>if only CouponName is given then all coupons contains specified name will be returned </li>
  <li>if any company is selected from company list then we will search all coupon from that company having specified name will be returned </li>
  <li>if any Category is selected from category list then we will search all coupon from that category having specified name will be returned </li>
  <li>if any date from all of threee date is been selected then we will filter coupon by that date </li>
  </ul>
  
  <p>now i am confused that what is the best way to do that , should i implement <code>if else</code> conditions , <code>switch</code> or what ?</p>