public ActionResult Index(FormCollection form) { ViewBag.ddlSearchUnit = GetItemsUnit(string.Empty); ViewBag.ddlSearchLedger = GetItemsLedger(string.Empty); var searchText = form["txtSearchText"].Trim(); var model = new ClientSearchViewModel { SearchText = searchText, SearchUnit = form["ddlSearchUnit"], SortField = form["SortField"], SortDirection = form["SortDirection"] }; ViewBag.ShowAdvancedSearch = form["hidIsAdvanced"].Trim(); form["hidIsAdvanced"] = ViewBag.ShowAdvancedSearch; ViewBag.txtSearchText = searchText; var searchUnit = form["ddlSearchUnit"]; var searchLedger = form["ddlSearchLedger"]; var searchName = form["txtSearchText"]; var searchClientCode = form["txtSearchClientCode"]; var searchAddress = form["txtSearchAddress"]; var searchUnderWriterPolicyNo = form["txtSearchUnderWriterPolicyNo"]; var searchMemoNo = form["txtSearchMemoNo"]; var searchInvoiceNo = form["txtSearchInvoiceNo"]; var searchDepositBsb = form["txtSearchDepositBSB"]; var searchDepositAccount = form["txtSearchDepositAccount"]; var clientFromAdvancedSearch = Searcher.AdvancedSearchProc(searchUnit, searchLedger, searchName, searchAddress, searchUnderWriterPolicyNo, searchMemoNo, searchInvoiceNo, searchDepositBsb, searchDepositAccount, searchClientCode); model.SearchResults = clientFromAdvancedSearch; var cache = new DefaultCacheProvider(); if (Request.LogonUserIdentity != null) { var cacheKey = Request.LogonUserIdentity.Name; cache.Set(cacheKey, model, 30); } //reset fields for reshowing ViewBag.ddlSearchUnit = GetItemsUnit(searchUnit); ViewBag.ddlSearchLedger = GetItemsLedger(searchLedger); ViewBag.txtSearchName = searchName; ViewBag.txtSearchAddress = searchAddress; ViewBag.txtSearchUnderWriterPolicyNo = searchUnderWriterPolicyNo; ViewBag.txtSearchMemoNo = searchMemoNo; ViewBag.txtSearchInvoiceNo = searchInvoiceNo; ViewBag.txtSearchDepositBSB = searchDepositBsb; ViewBag.txtSearchDepositAccount = searchDepositAccount; ViewBag.txtSearchClientCode = searchClientCode; return(View(model)); }