点这里进入ABP入门教程目录

创建目录

在展示层(即JD.CRS.Web.Mvc)的Views下新建文件夹Course //用以存放Course相关视图

创建视图

在JD.CRS.Web.Mvc/Views/Course下新建两个Razor视图

查询视图

Index.cshtml //用于查询Course List

 @using JD.CRS.Web.Startup
@model JD.CRS.Web.Models.Course.CourseListViewModel
@{
ViewBag.CurrentPageName = PageNames.Course; // The menu item will be active for this page.
}
@section scripts
{
<environment names="Development">
<script src="~/view-resources/Views/Course/Index.js" asp-append-version="true"></script>
</environment>
<environment names="Staging,Production">
<script src="~/view-resources/Views/Course/Index.min.js" asp-append-version="true"></script>
</environment>
}
<div class="row clearfix">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="card">
<div class="header">
<h2>
@L("Course")
</h2>
<ul class="header-dropdown m-r--5">
<li class="dropdown">
<a href="javascript:void(0);" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">more_vert</i>
</a>
<ul class="dropdown-menu pull-right">
<li>
<a id="RefreshButton" href="javascript:void(0);" class="waves-effect waves-block"><i class="material-icons">refresh</i>@L("Refresh")</a>
</li>
</ul>
</li>
</ul>
</div>
<div class="body table-responsive">
<table class="table">
<thead>
<tr>
<th>@L("Code")</th>
<th>@L("DepartmentCode")</th>
<th>@L("Name")</th>
<th>@L("Credits")</th>
<th>@L("Remarks")</th>
<th>@L("Status")</th>
<th>@L("Actions")</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Courses)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Code)
</td>
<td>
@Html.DisplayFor(modelItem => item.DepartmentCode)
</td>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Credits)
</td>
<td>
@Html.DisplayFor(modelItem => item.Remarks)
</td>
<td>
@Html.DisplayFor(modelItem => item.Status)
</td>
<td class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
<i class="material-icons">menu</i>
</a>
<ul class="dropdown-menu pull-right">
<li><a href="#" class="waves-effect waves-block edit-course" data-course-id="@item.Id" data-toggle="modal" data-target="#CourseEditModal"><i class="material-icons">edit</i>@L("Edit")</a></li>
<li><a href="#" class="waves-effect waves-block delete-course" data-course-id="@item.Id" data-course-name="@item.Name"><i class="material-icons">delete_sweep</i>@L("Delete")</a></li>
</ul>
</td>
</tr>
}
</tbody>
</table>
<button type="button" class="btn btn-primary btn-circle waves-effect waves-circle waves-float pull-right" data-toggle="modal" data-target="#CourseCreateModal">
<i class="material-icons">add</i>
</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="CourseCreateModal" tabindex="-1" role="dialog" aria-labelledby="CourseCreateModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<span>@L("CreateCourse")</span>
</h4>
</div>
<div class="modal-body">
<form name="courseCreateForm" role="form" class="form-validation">
<div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Code")</label>
<input type="text" name="Code" class="form-control" required maxlength="50" />
</div>
</div>
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("DepartmentCode")</label>
<input type="text" name="DepartmentCode" class="form-control" required maxlength="50" />
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Name")</label>
<input type="text" name="Name" class="form-control" required maxlength="150" />
</div>
</div>
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Credits")</label>
<input type="text" name="Credits" class="form-control"/>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-line">
<label class="form-label">@L("Remarks")</label>
<input name="Remarks" type="text" class="form-control" required maxlength="200" />
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-line">
<label class="form-label">@L("Status")</label>
<input name="Status" type="text" class="form-control" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default waves-effect" data-dismiss="modal">@L("Cancel")</button>
<button type="submit" class="btn btn-primary waves-effect">@L("Save")</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div class="modal fade" id="CourseEditModal" tabindex="-1" role="dialog" aria-labelledby="CourseEditModalLabel" data-backdrop="static">
<div class="modal-dialog" role="document">
<div class="modal-content">
</div>
</div>
</div>

创建/修改视图

_EditCourseModal.cshtml //用于创建/修改Course Item

 @using JD.CRS.Web.Models.Common.Modals
@model JD.CRS.Web.Models.Course.EditCourseModalViewModel
@{
Layout = null;
}
@Html.Partial("~/Views/Shared/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("EditCourse"))) <div class="modal-body">
<form name="CourseEditForm" role="form" novalidate class="form-validation">
<input type="hidden" name="Id" value="@Model.Course.Id" />
<div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Code")</label>
<input type="text" name="Code" value="@Model.Course.Code" class="form-control" required maxlength="50" />
</div>
</div>
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("DepartmentCode")</label>
<input type="text" name="DepartmentCode" value="@Model.Course.DepartmentCode" class="form-control" required maxlength="50" />
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Name")</label>
<input type="text" name="Name" value="@Model.Course.Name" class="form-control" required maxlength="150" />
</div>
</div>
<div class="col-sm-6">
<div class="form-line">
<label class="form-label">@L("Credits")</label>
<input type="text" name="Credits" value="@Model.Course.Credits" class="form-control"/>
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-line">
<label class="form-label">@L("Remarks")</label>
<input name="Remarks" type="text" value="@Model.Course.Remarks" class="form-control" required maxlength="200" />
</div>
</div>
</div>
<div class="row clearfix">
<div class="col-sm-12">
<div class="form-line">
<label class="form-label">@L("Status")</label>
<input name="Status" type="text" value="@Model.Course.Status" class="form-control" />
</div>
</div>
</div>
</form>
</div>
@Html.Partial("~/Views/Shared/Modals/_ModalFooterWithSaveAndCancel.cshtml") <script src="~/view-resources/Views/Course/_EditCourseModal.js" asp-append-version="true"></script>

最新文章

  1. BPM配置故事之案例10-获取外部数据
  2. CentOS7安装mysql提示“No package mysql-server available.”
  3. 希尔排序及希尔排序java代码
  4. Bash实用技巧:同时循环两个列表
  5. FinanceJson
  6. Why Consumer Hardware Start-ups Fail
  7. kafka0.8.2以下版本删除topic
  8. Eclipse搭建Android5.0应用开发环境 “ndk-build”:launchingfailed问题解决
  9. karma+angular
  10. 3.第一个python程序
  11. Android问题-XE5提示&quot;[DCC Fatal Error] Project1.dpr(1): F1027 Unit not found: &#39;System.pas&#39; or binary equivalents (.dcu/.o)&quot;
  12. [Locked] Closest Binary Search Tree Value &amp; Closest Binary Search Tree Value II
  13. POI数据下载器
  14. 解析java泛型(二)
  15. 【JQUERY】插件的写法
  16. Cannot create an instance of OLE DB provider “OraOLEDB.Oracle” for linked server &quot;xxxxxxx&quot;.
  17. java中StringUtils中isEmpty 和isBlank的区别
  18. GCC后端移植杂记
  19. https://blog.csdn.net/doegoo/article/details/50749817
  20. segMatch:基于3D点云分割的回环检测

热门文章

  1. PWM是如何调节直流电机转速的?电机正反转的原理又是怎样的?
  2. System.out.println高并发下导致应用暂停
  3. c++11多线程笔记
  4. Python中的四种交换数值的方法
  5. Prometheus学习系列(二)之Prometheus FIRST STEPS
  6. How to: Specify a Display Member (for a Lookup Editor, Detail Form Caption, etc.)如何:指定显示成员(用于查找编辑器、详细信息表单标题等)
  7. 番茄助手 最新 Visual Assist X 适应于VS2019 VS2017 VS2015 VS2013 亲测可用
  8. SSH框架之Spring+Struts2+Hibernate整合篇
  9. Cesium 动态绘制点线面(附源码下载)
  10. 一文解读JSON (转)