Admin

菜单 增加 siteMap.config增加一行

      <siteMapNode SystemName="Hotels" nopResource="Admin.Catalog.Hotels" PermissionNames="ManageProducts" controller="Hotel" action="List" IconClass="fa-dot-circle-o"/>

Controllers  增加新控制器

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Nop.Admin.Extensions;
using Nop.Admin.Models.Blogs;
using Nop.Core.Domain.Blogs;
using Nop.Core.Domain.Customers;
using Nop.Services.Hotels;
using Nop.Services.Helpers;
using Nop.Services.Localization;
using Nop.Services.Security;
using Nop.Services.Seo;
using Nop.Services.Stores;
using Nop.Web.Framework;
using Nop.Web.Framework.Controllers;
using Nop.Web.Framework.Kendoui;
using Nop.Web.Framework.Mvc; namespace Nop.Admin.Controllers
{
public class HotelController : Controller
{ #region Fields private readonly IHotelService _hotelService;
private readonly ILanguageService _languageService;
private readonly IDateTimeHelper _dateTimeHelper;
private readonly ILocalizationService _localizationService;
private readonly IPermissionService _permissionService;
private readonly IUrlRecordService _urlRecordService;
private readonly IStoreService _storeService;
private readonly IStoreMappingService _storeMappingService; #endregion #region Constructors public HotelController(IHotelService hotelService, ILanguageService languageService,
IDateTimeHelper dateTimeHelper,
ILocalizationService localizationService, IPermissionService permissionService,
IUrlRecordService urlRecordService,
IStoreService storeService, IStoreMappingService storeMappingService)
{
this._hotelService = hotelService;
this._languageService = languageService;
this._dateTimeHelper = dateTimeHelper;
this._localizationService = localizationService;
this._permissionService = permissionService;
this._urlRecordService = urlRecordService;
this._storeService = storeService;
this._storeMappingService = storeMappingService;
} #endregion // GET: Hotel
public ActionResult Index()
{
return View();
} public ActionResult List()
{
return View();
} [HttpPost]
public ActionResult List(DataSourceRequest command)
{
var hotels = _hotelService.GetAllHotels(command.Page-,command.PageSize,true);
var gridModel = new DataSourceResult
{
Data=hotels,
Total=hotels.TotalCount
};
return Json(gridModel); }
}
}

视图  增加  List.cshtml

@{
//page title
ViewBag.Title = T("Admin.Catalog.Manufacturers").Text;
} @Html.AntiForgeryToken() <div class="content-header clearfix">
<h1 class="pull-left">
@T("Admin.Catalog.Manufacturers")
</h1>
<div class="pull-right">
<a href="@Url.Action("Create")" class="btn bg-blue">
<i class="fa fa-plus-square"></i>
@T("Admin.Common.AddNew")
</a>
</div>
</div> <div class="content">
<div class="form-horizontal">
<div class="panel-group">
<div class="panel panel-default panel-search">
<div class="panel-body">
</div>
</div> <div class="panel panel-default">
<div class="panel-body">
<div id="hotels-grid"></div> <script>
$(document).ready(function() {
$("#hotels-grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: {
url: "@Html.Raw(Url.Action("List", "Hotel"))",
type: "POST",
dataType: "json",
data: additionalData
}
},
schema: {
data: "Data",
total: "Total",
errors: "Errors"
},
error: function(e) {
display_kendoui_grid_error(e);
// Cancel the changes
this.cancelChanges();
},
pageSize:,
serverPaging: true,
serverFiltering: true,
serverSorting: true
},
pageable: {
refresh: true,
pageSizes: []
},
editable: {
confirmation: "@T("Admin.Common.DeleteConfirmation")",
mode: "inline"
},
scrollable: false,
columns: [
{
field: "Name",
width: ,
title: "酒店名称"
}, {
field: "Telephone",
width: ,
title: "电话"
}, {
field: "Introduce",
title: "介绍"
}, {
field: "Id",
title: "@T("Admin.Common.Edit")",
width: ,
template: '<a href="Edit/#=Id#">@T("Admin.Common.Edit")</a>'
}
]
});
});
</script> <script type="text/javascript">
$(document).ready(function() {
//search button
//$('#search-manufacturers').click(function() {
// //search
// var grid = $('#manufacturers-grid').data('kendoGrid');
// grid.dataSource.page(1); //new search. Set page size to 1
// //grid.dataSource.read(); we already loaded the grid above using "page" function
// return false;
//}); @*$("#@Html.FieldIdFor(model => model.SearchManufacturerName)").keydown(function(event) {
if (event.keyCode == ) {
$("#search-manufacturers").click();
return false;
}
});*@
}); function additionalData() {
var data = {
};
addAntiForgeryToken(data);
return data;
}
</script>
</div>
</div>
</div>
</div>
</div>

最新文章

  1. JavaScript的two-sum问题解法
  2. HttpClient, HttpClientHandler, and WebRequestHandler Explained
  3. 利用activeX控件在网页里自动登录WIN2003远程桌面并实时控制
  4. 工具 cocoapods和插件
  5. IoC 之 2.2 IoC 容器基本原理(贰)
  6. SQL2005中设置自动编号字段【转】
  7. iis实现类似tomcat ip:port直接访问站点
  8. 如何彻底隐藏iOS7应用的status bar
  9. 捉虫记2:windows程序句柄泄露的上下文环境
  10. 【转】linux(Ubuntu)配置svn仓库,搭建svn服务器
  11. 把测试app打包成ipa文件
  12. 高效CSS开发核心要点摘录
  13. .net core 13
  14. Aggregate累加器
  15. windows环境中利用NMake工具编译连接C++源代码
  16. K:java中正则表达式的使用说明及其举例
  17. eclipse 启动报内存溢出的问题out of memory!
  18. Axure8.0 如何在函数里直接更改文本颜色?
  19. 洛谷 P4302 【[SCOI2003]字符串折叠】
  20. iOS QQ 扫一扫 捷径URL

热门文章

  1. bx, bp, si, di寄存器的使用规则
  2. Digital root(数根)
  3. memcache/memcached安装教程并应用Tinkphp3.2
  4. 微信上传文章素材—ASP.NET MVC从View层传数据到Controller层
  5. 发布 Ionic iOS 企业级应用
  6. [转]windows下编译及使用libevent
  7. [经验交流] Active-Active 方式设置 kubernetes master 多节点高可用
  8. 基于WebDriverAgent代理服务,实现iOS手机app自动化测试的框架搭建
  9. 黄聪:如何为IIS增加svg和woff等字体格式的MIME
  10. screenshot of termbox cjk commit