In my C# app I am showing order list in a table. The url to that page is
/Organization/Orders/id
id in this case is organization id. My controller looks like this
[HttpGet]
public ActionResult Orders(String id)
{
Organization org = Organization.Get(id);
ViewBag.Orders = org.GetOrders(50).ToList();
return View(org);
}
Now I am trying to implement a search functionality in there. In the view I have a search form going on. When the user hits the search button I take him to this controller
[HttpPost]
public ActionResult Orders(String orgId, OrderSearch os)
{
Organization org = Organization.Get(orgId);
ViewBag.Orders = org.GetOrders(50).Where(i => i.GetLocation().FriendlyName.Contains(os.FriendlyName)).ToList();
return View(org);
}
The issue with this approach is that, if the user search for a particular location name it will take him to the Post method. It will work fine but lets assume that the user refreshes the browser it will still show the searched content rather than the reset the search.
I understand it is because I am in the post method and in the post parameters I would have locationName.
So, is there any other good way to do implement search?