Asp.net 列表中的多个搜索

Asp.net 列表中的多个搜索,asp.net,asp.net-mvc,entity-framework,model-view-controller,Asp.net,Asp.net Mvc,Entity Framework,Model View Controller,我试图搜索具有多个参数的列表,但我输入的参数返回的是空列表 public ActionResult Index(string accountNo, string bookingDate, string productType) { DataModel db = new DataModel(); var kIRDates = from m in db.KIRDates where

我试图搜索具有多个参数的列表,但我输入的参数返回的是空列表

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);
        }
public ActionResult索引(string accountNo、string bookingDate、string productType)
{
DataModel db=新的DataModel();
var kIRDates=从m开始,单位为db.kIRDates
其中m.Verbund.ToString()==accountNo.ToString()| | accountNo.ToString()==null | | accountNo.ToString()
其中m.belegdatam.ToString()==bookingDate.ToString()| | | bookingDate.ToString()==null | | | bookingDate.ToString()==“”
其中m.Sparte==productType | | productType==null | | productType==“”
选择m;
会话[“kIRDates”]=kIRDates.ToList();
返回视图(日期);
}
@使用(Html.BeginForm(“Index”,“kirdat”,FormMethod.Get))
{
@Html.TextBox(“accountNo”)
@Html.TextBox(“预订日期”)
@Html.TextBox(“productType”)
}

很难根据问题中的详细程度来判断您在寻找什么,但您可以尝试下面的代码

    public ActionResult Index(string accountNo, string bookingDate, string productType)
    {
        DataModel db = new DataModel();
        var kIRDates = db.KIRDates.Where(m => m.Verbund.ToString() == accountNo || m.Belegdatum.ToString() == bookingDate || m.Sparte.ToString() == productType);

        Session["kIRDates"] = kIRDates.ToList<KIRDate>();
        return View(kIRDates);
    }
public ActionResult索引(string accountNo、string bookingDate、string productType)
{
DataModel db=新的DataModel();
var kIRDates=db.kIRDates.Where(m=>m.Verbund.ToString()==accountNo | | m.belegdatam.ToString()==bookingDate | | m.Sparte.ToString()==productType);
会话[“kIRDates”]=kIRDates.ToList();
返回视图(日期);
}

很难根据问题中的详细程度来判断您在寻找什么,但您可以尝试下面的代码

    public ActionResult Index(string accountNo, string bookingDate, string productType)
    {
        DataModel db = new DataModel();
        var kIRDates = db.KIRDates.Where(m => m.Verbund.ToString() == accountNo || m.Belegdatum.ToString() == bookingDate || m.Sparte.ToString() == productType);

        Session["kIRDates"] = kIRDates.ToList<KIRDate>();
        return View(kIRDates);
    }
public ActionResult索引(string accountNo、string bookingDate、string productType)
{
DataModel db=新的DataModel();
var kIRDates=db.kIRDates.Where(m=>m.Verbund.ToString()==accountNo | | m.belegdatam.ToString()==bookingDate | | m.Sparte.ToString()==productType);
会话[“kIRDates”]=kIRDates.ToList();
返回视图(日期);
}