我有搜索查询的视图
@model MvcA. Models.SellsLiveSearch@using ( Html.BeginForm ("Search", "Search",FormMethod .Get)) {
@Html. ValidationSummary(true )
<fieldset>
<legend> Введите данные </legend>
<select id="HowManyRoom" name= "HowManyRoom" ><option></ option>
<option value="1" >1</ option>
<option value="2" >2</ option>
<option value="3" >3</ option>
<option value="4" >4</ option>
<option value="5" >4</ option>
</select>
<select id="TimeRange" name= "TimeRange" ><option></ option>
<option> 1 </option >
<option> 2 </option >
<option> 3 </option >
<option> 4 </option >
</select>
@Html. TextBox ("expencefrom")
@Html. TextBox ("expenceto")
<p>
<input type="submit" value= "Search" />
</p>
</fieldset>}
控制器
[HttpGet]
public ActionResult SearchPost(SellsLiveSearch Per)
{ string query = "SELECT * FROM SellsLives WHERE SellsLiveID!=0"
if (Per .HowManyRoom !=null )
{ query = query + " AND HowManyRoom=" + Per.HowManyRoom ;
}
if (Per .TimeRange != "" )
{ query =query + " AND TimeRange=" + Per.TimeRange ;
}
if (Per .ExpenceFrom != null )
{ query = query + " AND Expence<=" + Per.ExpenceFrom ; }
int newcost ;
if (Per .ExpenceTo != null )
{
newcost = (int)( 0.1 * Per. ExpenceTo + Per. ExpenceTo);
query = query + " AND Expence>=" + newcost;
}
}
我想在缓存中保存搜索结果并为页面分页。
问题:
如何最好地处理翻页?
为传输的Get-query页面的处理做出额外的操作?或者给另一个控制器分页,并且将单独的搜索页面和结果分开,这将由另一个控制器处理并具有另一个地址并从缓存结果中获取?或者根据指定的页面进行一个选择处理的常用操作?
最后一页应该包含参数Get-request和页码,如何到达那里?