多条件查询判断
/// <summary>
/// 查询条件
/// </summary>
/// <param name="name"></param>
/// <param name="xiaoqu"></param>
/// <param name="donghao"></param>
/// <param name="huxing"></param>
/// <param name="zhuangtai"></param>
/// <returns></returns>
public ActionResult Select(string name = "", string xiaoqu = "", string donghao = "", string huxing = "", string zhuangtai = "")
{
XiaoQu();
DongHao();
HuXing();
ZhuangTai();
string where = "";
if (!string.IsNullOrWhiteSpace(name))
{
where += "a.ZuoLuo like '%" + name + "%'";
}
if (!string.IsNullOrEmpty(xiaoqu))
{
where += "and a.XiaoQuID = " + xiaoqu + "";
}
if (!string.IsNullOrWhiteSpace(donghao))
{
where += "and a.DongHao = " + donghao + "";
}
if (!string.IsNullOrWhiteSpace(huxing))
{
where += "and a.HuXingID = " + huxing + "";
}
if (!string.IsNullOrWhiteSpace(zhuangtai))
{
where += "and a.ZhuangTaiID = " + zhuangtai + "";
}
Where = where;
List<UserInfoModel> list = ShowPage();
return View("Index", list);
}