ABP入门教程11 - 展示层实现增删改查-视图
创建目录
在展示层(即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>
ABP入门教程11 - 展示层实现增删改查-视图的更多相关文章
- ABP入门教程9 - 展示层实现增删改查-视图模型
点这里进入ABP入门教程目录 创建视图模型 在展示层(即JD.CRS.Web.Mvc)的Models下新建文件夹Course //用以存放Course相关视图模型 在JD.CRS.Web.Mvc/Mo ...
- ABP入门教程10 - 展示层实现增删改查-控制器
点这里进入ABP入门教程目录 创建控制器 在展示层(即JD.CRS.Web.Mvc)的Controllers下新建一个控制器CourseController.cs using Abp.Applicat ...
- ABP入门教程12 - 展示层实现增删改查-脚本
点这里进入ABP入门教程目录 创建目录 在展示层(即JD.CRS.Web.Mvc)的\wwwroot\view-resources\Views\下新建文件夹Course //用以存放Course相关脚 ...
- abp(net core)+easyui+efcore仓储系统——展现层实现增删改查之控制器(六)
abp(net core)+easyui+efcore仓储系统目录 abp(net core)+easyui+efcore仓储系统——ABP总体介绍(一) abp(net core)+easyui+e ...
- ABP入门系列(6)——展现层实现增删改查
这一章节将通过完善Controller.View.ViewModel,来实现展现层的增删改查.最终实现效果如下图: 一.定义Controller ABP对ASP.NET MVC Controllers ...
- ABP入门系列(5)——展现层实现增删改查
ABP入门系列目录--学习Abp框架之实操演练 这一章节将通过完善Controller.View.ViewModel,来实现展现层的增删改查.最终实现效果如下图: 一.定义Controller ABP ...
- abp(net core)+easyui+efcore实现仓储管理系统——展现层实现增删改查之列表视图(七)
abp(net core)+easyui+efcore实现仓储管理系统目录 abp(net core)+easyui+efcore实现仓储管理系统——ABP总体介绍(一) abp(net core)+ ...
- 基于renren-fast的快速入门项目实战(实现报表增删改查)
基于renren-fast的快速入门项目实战(实现报表增删改查) 说明:renren-fast是一个开源的基于springboot的前后端分离手脚架,当前版本是3.0 官方开发文档需付费,对于新手而言 ...
- 数据库Dao层编增删改查写,数据库事务,数据库升级
数据库事务 有两个特点 1.安全性 情景:正常的转账行为,这个时候如果出现停电等异常,已经扣钱但是没有加钱:这个时候就可用数据库事务解决问题 2.高效性: 使用数据库事务添加享受同数量的数据,对比耗时 ...
随机推荐
- 利用Azure虚拟机安装Dynamics 365 Customer Engagement之六:安装后端服务器
我是微软Dynamics 365 & Power Platform方面的工程师罗勇,也是2015年7月到2018年6月连续三年Dynamics CRM/Business Solutions方面 ...
- ORACLE spool打印
问题描述:spool让我想起来了spooling假脱机,但是这个spool是oracle下的命令,将select查询出来的数据打印出来 1.linuxi下 spool +路径+文件名,这里的文件如果不 ...
- 集合系列 Queue(十一):ArrayDeque
从名字我们可以看出,其实一个双向队列实现,而且底层采用数组实现. public class ArrayDeque<E> extends AbstractCollection<E> ...
- 2019icpc银川站 复现赛
打了计蒜客上的银川重现赛,总体感觉难度上确实比平时区域赛要低上一些. 这里补一下F题和G题的思路和代码. upd:I题也补了,理解差不多都在注释里. F题 做法,玩一下n=10的样例就出 ...
- 【译】浅谈SOLID原则
SOLID原则是一种编码的标准,为了避免不良设计,所有的软件开发人员都应该清楚这些原则.SOLID原则是由Robert C Martin推广并被广泛引用于面向对象编程中.正确使用这些规范将提升你的代码 ...
- TensorFlow实现简单线性回归示例代码
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import matplotlib.pyplot as plt d ...
- Flutter安装入门教程
### 前言 Flutter是谷歌的移动UI框架,可以快速在iOS和Android上构建高质量的原生用户界面. Flutter可以与现有的代码一起工作.在全世界,Flutter正在被越来越多的开发者和 ...
- 【Beta阶段】第十二周Scrum会议
[Beta阶段]第十二周Scrum会议 本次会议为第十二周第一次Scrum Meeting,会议对Beta阶段工作进行了总结,针对Beta阶段还未完成的问题进行了讨论. 会议时间为2019.12.3. ...
- 获取Tekla属性方式
XmlTextWriter xmlTextWriter = new XmlTextWriter((TextWriter) stringWriter); xmlTextWriter.Formatting ...
- mysql初始化/usr/local/mysql/bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
[root@test153 ~]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql - ...