title: MVC3: PRG Pattern with Search Filters on Action Method
body: <p>I have a controller with an Index method that has several optional parameters for filtering results that are returned to the view.</p>
  
  
  
  <pre><code>public ActionResult Index(string searchString, string location, string status) {
      ...
  
  product = repository.GetProducts(string searchString, string location, string status);
  
  return View(product);
  }
  </code></pre>
  
  <p>I would like to implement the PRG Pattern like below but I'm not sure how to go about it.</p>
  
  <pre><code>[HttpPost]
  public ActionResult Index(ViewModel model) {
      ...
      if (ModelState.IsValid) {
          product = repository.GetProducts(model);
      return RedirectToAction(); // Not sure how to handle the redirect
      }
  return View(model);
  }
  </code></pre>
  
  <p>My understanding is that you should not use this pattern if:</p>
  
  <ul>
  <li>You do not need to use this pattern unless you have actually stored some data (I'm not)</li>
  <li>You would not use this pattern to avoid the "Are you sure you want to resubmit" message from IE when refreshing the page (guilty)</li>
  </ul>
  
  <p>Should I be trying to use this pattern? If so, how would I go about this?</p>
  
  <p>Thanks!</p>