@{
Layout = null;
}
@model List<Model.Commodity>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/scripts/jquery-1.10.2.js"></script>
<link href="~/scripts/bootstrap.css" rel="stylesheet" />
<script>
$(function () {
$("#btn_Dels").click(function () {
if (confirm("确定要删除吗")) {
var ids = "";
$("[name='ck_row']:checked").each(function () {
ids += $(this).val() + ",";
})
$.ajax({
url: "/Admin/Dels/?id=" + ids.toString(),
type: "post",
success: function (data) {
if (data > 0) {
alert("删除成功");
location.href = "/Admin/Index";
}
}
})
}
})
})
function Delete(id){
if (confirm("确定要删除吗")) {
$.ajax({
url: "/Admin/Delete/"+id,
type: "get",
success: function (data) {
if (data > 0) {
alert("删除成功");
location.href = "/Admin/Index";
}
}
})
}
}
$(function () {
$("#ck_All").click(function () {
$("[name='ck_row']").prop("checked", $("#ck_All").prop("checked"));
})
})
</script>
</head>
<body>
@using (Html.BeginForm())
{
<div style="800px;margin: 0 auto">
<select name="Xname">
<option value="">请选择</option>
<option value="1">瑞景河畔</option>
<option value="2">库克腾格日</option>
<option value="3">葛根格日乐</option>
</select>
<select name="Hname">
<option value="">请选择</option>
<option value="1">一室一厅一卫</option>
<option value="2">二室一厅一卫</option>
<option value="3">三室一厅一卫</option>
<option value="4">四室一厅二卫</option>
<option value="5">五室一厅二卫</option>
</select>
<select name="Rname">
<option value="">请选择</option>
<option value="1">1号楼</option>
<option value="2">2号楼</option>
<option value="3">3号楼</option>
<option value="4">4号楼</option>
<option value="5">5号楼</option>
<option value="6">6号楼</option>
</select>
<select name="Sname">
<option value="">请选择</option>
<option value="1">建成待租</option>
<option value="2">已租</option>
<option value="3">欠费</option>
<option value="4">未建成</option>
</select>
<input id="Text1" type="text" name="Lname" />
<input id="Submit1" type="submit" value="查询" />
<input type="button" value="批量删除" id="btn_Dels" />
</div>
}
<div style="1000px;margin: 0 auto">
<table class="table table-bordered">
<tr>
<td><input id="ck_All" type="checkbox" />全选后反选</td>
<td>位置</td>
<td>房源面积</td>
<td>计组面积</td>
<td>建筑结构</td>
<td>租赁</td>
<td>状态</td>
<td>小区</td>
<td>楼栋</td>
<td>户型</td>
<td>房源</td>
<td>操作</td>
</tr>
@foreach (var item in Model)
{
<tr>
<td><input id="Checkbox1" type="checkbox" name="ck_row" value="@item.id" /></td>
<td>@item.Wez</td>
<td>@item.Farea</td>
<td>@item.Jarea</td>
<td>@item.structure</td>
<td>@item.Nature</td>
<td>@item.Sname</td>
<td>@item.Xname</td>
<td>@item.Rname</td>
<td>@item.Hname</td>
<td>@item.Lname</td>
<td>
<input id="Button1" type="button" value="删除" onclick="Delete(@item.id)" />
</td>
</tr>
}
</table>
</div>
<div style="600px;margin: 0 auto">
<p>
共有 @ViewBag.totalPage 页,当前第 @(ViewBag.PageIndex + 1) 页,共有 @ViewBag.totalNum 条数据
@Ajax.ActionLink("首页", "index", new { id = 0 }, new AjaxOptions { })
@if ((ViewBag.PageIndex + 1) == 1)
{
<span>上一页</span>
}
else
{
@Ajax.ActionLink("上一页", "index", new { id = ViewBag.PageIndex - 1 }, new AjaxOptions { })
}
@if ((ViewBag.PageIndex + 1) >= ViewBag.totalPage)
{
<span>下一页</span>
}
else
{
@Ajax.ActionLink("下一页", "index", new { id = ViewBag.PageIndex + 1 }, new AjaxOptions { })
}
@Ajax.ActionLink("尾页", "index", new { id = ViewBag.totalPage - 1 }, new AjaxOptions { })
</p>
</div>
</body>
</html>