构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(9)-MVC与EasyUI结合增删改查
2014-02-23 12:53
483 查看
原文:构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(9)-MVC与EasyUI结合增删改查
在第八讲中,我们已经做到了怎么样分页。这一讲主要讲增删改查。第六讲的代码已经给出,里面包含了增删改,大家可以下载下来看下。这讲主要是,制作漂亮的工具栏,虽然easyui的datagrid已经自带可以设置工具栏,我们还是要提取出来,为以后权限控制做更好的准备。
前端代码没有逻辑结果,这也许是我写代码以来写得最轻松的,但也是最繁琐的,因为美工我不是强项,每一次调整都非常的困难,最后我把他调成了这样了:
Create
下面的太简单了,修改和详细自己动手做起来吧。说得太明白东西就没什么意思了
给点提示,修改就把创建复制一份,保存的时候把url指到修改
详细就把保存去掉就可以了
查询,在Controller的GetList增加一个queryStr参数,在BLL判断是queryStr是否为空。不为空就用Linq写多个where,O了
在第八讲中,我们已经做到了怎么样分页。这一讲主要讲增删改查。第六讲的代码已经给出,里面包含了增删改,大家可以下载下来看下。这讲主要是,制作漂亮的工具栏,虽然easyui的datagrid已经自带可以设置工具栏,我们还是要提取出来,为以后权限控制做更好的准备。
前端代码没有逻辑结果,这也许是我写代码以来写得最轻松的,但也是最繁琐的,因为美工我不是强项,每一次调整都非常的困难,最后我把他调成了这样了:
@model App.Models.Sys.SysSampleModel @using App.Common; @using App.Models.Sys; @using App.Admin; @{ ViewBag.Title = "创建"; Layout = "~/Views/Shared/_Index_LayoutEdit.cshtml"; } <script type="text/javascript"> $(function () { $("#btnSave").click(function () { $.ajax({ url: "/SysSample/Create", type: "Post", data: $("#CreateForm").serialize(), dataType: "json", success: function (data) { if (data == 1) { window.parent.frameReturnByMes("成功"); window.parent.frameReturnByReload(true); window.parent.frameReturnByClose() } else { window.parent.frameReturnByMes("失败"); } } }); }); }); </script> <div class="mvctool bgb"> <a id="btnSave" style="float: left;" class="l-btn l-btn-plain"><span class="l-btn-left"><span class="l-btn-text icon-save" style="padding-left: 20px;">保存</span></span></a> </div> @using (Html.BeginForm("Create", "SysSample", null, FormMethod.Post, new { Id = "CreateForm" })) { @Html.ValidationSummary(true) <table class="fromEditTable setTextWidth300"> <tbody> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Id): </td> <td style="width:310px"> @Html.EditorFor(model => model.Id) </td> <td>@Html.ValidationMessageFor(model => model.Id)</td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Name): </td> <td> @Html.EditorFor(model => model.Name) </td> <td> @Html.ValidationMessageFor(model => model.Name) </td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Age): </td> <td> @Html.EditorFor(model => model.Age) </td> <td> @Html.ValidationMessageFor(model => model.Age) </td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Bir): </td> <td> @Html.TextBoxFor(model => model.Bir) </td> <td> @Html.ValidationMessageFor(model => model.Bir) </td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Note): </td> <td> @Html.EditorFor(model => model.Note) </td> <td> @Html.ValidationMessageFor(model => model.Note) </td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.CreateTime): </td> <td> @Html.TextBoxFor(model => model.CreateTime) </td> <td> @Html.ValidationMessageFor(model => model.CreateTime) </td> </tr> <tr> <td style="width:100px; text-align:right;"> @Html.LabelFor(model => model.Photo): </td> <td> @Html.TextBoxFor(model => model.Photo) </td> <td> @Html.ValidationMessageFor(model => model.Photo) </td> </tr> </tbody> </table> }
Create
下面的太简单了,修改和详细自己动手做起来吧。说得太明白东西就没什么意思了
给点提示,修改就把创建复制一份,保存的时候把url指到修改
详细就把保存去掉就可以了
查询,在Controller的GetList增加一个queryStr参数,在BLL判断是queryStr是否为空。不为空就用Linq写多个where,O了
相关文章推荐
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(9)-MVC与EasyUI结合增删改查
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(7)-MVC与EasyUI DataGrid
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(8)-MVC与EasyUI DataGrid 分页
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(7)-MVC与EasyUI DataGrid
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(38)-Easyui-accordion+tree漂亮的菜单导航
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(2)-easyui构建前端页面框架[附源码]
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(38)-Easyui-accordion+tree漂亮的菜单导航
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(2)-easyui构建前端页面框架[附源码]
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(14)-EasyUI缺陷修复与扩展
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(31)-MVC使用RDL报表
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(44)-工作流设计-设计表单
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(23)-权限管理系统-角色组模块
- (转)构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(5)-EF增删改查by糟糕的代码
- 构建ASP.NET MVC4+EF5+EasyUI+Unity2.x注入的后台管理系统(10)-系统菜单栏[附源码]