我将搜索字符串从搜索操作传递到详细操作,但在收到详细操作时结果为空。
我正在使用 MVC3 和 .NET 框架 4.0:
public ActionResult Search(string search)
{
if (string.IsNullOrEmpty(search))
return RedirectToAction("Index");
return RedirectToAction("Details", "Invoice", search = search.Trim());
}
public ActionResult Details(string id)
{
if (string.IsNullOrEmpty(id))
return RedirectToAction("Index");
ObjectParameter[] parameters = new ObjectParameter[3];
parameters[0] = new ObjectParameter("CUSTNMBR", id);
parameters[1] = new ObjectParameter("StartDate", System.DateTime.Now.Date.AddDays(-90));
parameters[2] = new ObjectParameter("EndDate", System.DateTime.Now.Date);
return View(_db.ExecuteFunction<Models.Invoices>("uspGetCustomerInvoices", parameters).ToList<Models.Invoices>());
}