日期:2014-05-18 浏览次数:20574 次
@model IEnumerable<taomei.Models.Members.MemberInfo> @{ ViewBag.Title = "会员信息列表"; } <h2> 会员信息列表</h2> <p> @Html.ActionLink("添加会员", "Create") </p> <table> <tr> <td>用户名</td> <td> <input id="txtUserName" type="text" /> </td> <td>注册时间</td> <td> </td> </tr> </table> <table style="width: 800px; text-align: center;"> <tr> <th> 用户名 </th> <th> 姓名 </th> <th> 区域 </th> <th> 地址 </th> <th> 电话 </th> <th> 状态 </th> <th> </th> </tr> @foreach (var item in Model) { <tr> <td> @Html.DisplayFor(modelItem => item.MembUserName) </td> <td> @Html.DisplayFor(modelItem => item.MembName) </td> <td> @item.MembRegion.ProvinceName @item.MembRegion.CityName @item.MembRegion.DistrictName </td> <td> @Html.DisplayFor(modelItem => item.MembAddr) </td> <td> @Html.DisplayFor(modelItem => item.MembPhone) </td> <td> @(item.MembStatus == 1 ? "有效" : "无效") </td> <td> @Html.ActionLink("修改", "ModifyInfo", new { id = item.MemberId }) @Html.ActionLink("详情", "Detials", new { id = item.MemberId }) </td> </tr> } </table>
查询:<input type="text" name="keyword" value="@ViewBag.keyword">
------解决方案--------------------
if (!string.IsNullOrEmpty(AccountName)) { query = query.Where(lc => lc.AccountName.Contains(AccountName)); } if (!string.IsNullOrEmpty(LCAgentName)) { query = query.Where(lc => lc.LCAgentName.Contains(LCAgentName)); } if (!string.IsNullOrEmpty(ServerIB)) { query = query.Where(lc => lc.ServerIB.Contains(ServerIB)); } if (!string.IsNullOrEmpty(IAM)) { query = query.Where(lc => lc.IAM.Contains(IAM)); }