【发布时间】:2019-10-17 13:17:45
【问题描述】:
我正在尝试搜索具有多个参数的列表,但我输入的参数返回一个空列表
public ActionResult Index(string accountNo, string bookingDate, string productType)
{
DataModel db = new DataModel();
var kIRDates = from m in db.KIRDates
where m.Verbund.ToString() == accountNo.ToString() || accountNo.ToString() == null || accountNo.ToString() == ""
where m.Belegdatum.ToString() == bookingDate.ToString() || bookingDate.ToString() == null || bookingDate.ToString() == ""
where m.Sparte == productType || productType == null || productType == ""
select m;
Session["kIRDates"] = kIRDates.ToList<KIRDate>();
return View(kIRDates);
}
@using (Html.BeginForm("Index", "KIRData", FormMethod.Get))
{
@Html.TextBox("accountNo")
@Html.TextBox("bookingDate")
@Html.TextBox("productType")
<input type="submit" value="Search" />
}
【问题讨论】:
标签: asp.net asp.net-mvc entity-framework model-view-controller