标签:asp dynamic 新建 alt 应用 tar pos public 标题
public class Category:Entity { /// <summary> /// 分类名称 /// </summary> public string Name { get; set; } }
public interface ICategoryRepository: IRepository<Category> { }
public class CategoryRepository: AbpZeroTemplateRepositoryBase<Category>,ICategoryRepository { public CategoryRepository(IDbContextProvider<AbpZeroTemplateDbContext> dbContextProvider) : base(dbContextProvider) { } }
public class CategoryOutput : IOutputDto { public int Id { get; set; } public string Name { get; set; } } public class GetCategoriesOutput : IOutputDto { public List<CategoryOutput> Items { get; set; } }
public interface ICategoryAppService : IApplicationService { PagedResultOutput<CategoryOutput> GetCategories(); }
public class CategoryAppService : AbpZeroTemplateAppServiceBase, ICategoryAppService { private readonly ICategoryRepository _categoryRepository; public CategoryAppService(ICategoryRepository categoryRepository) { _categoryRepository = categoryRepository; } public PagedResultOutput<CategoryOutput> GetCategories() { //创建映射 Mapper.CreateMap<Category, CategoryOutput>(); var result=_categoryRepository.GetAllList(); int totalCount = result.Count; return new PagedResultOutput<CategoryOutput>( totalCount, Mapper.Map<List<CategoryOutput>>(result) ); } }
public class CategoryController : AbpZeroTemplateControllerBase { // GET: Mpa/Category public ActionResult Index() { return View(); } }
@using Abp.Web.Mvc.Extensions @using MyCompanyName.AbpZeroTemplate.Web.Navigation @{ ViewBag.CurrentPageName = PageNames.App.Common.Category;//作用就是选中菜单时会高亮 } @section Scripts { @Html.IncludeScript("~/Areas/Mpa/Views/Category/Index.js") } <div class="row margin-bottom-5"> <div class="col-xs-6"> <div class="page-head"> <div class="page-title"> <h1> <span>分类</span> <small>@L("CategoryManager")</small> </h1> </div> </div> </div> </div> <div class="portlet light"> <div class="portlet-body"> <div> <div id="CategoriesTable"></div> </div> </div> </div>
(function () { $(function () { var _$categoriesTable = $(‘#CategoriesTable‘); var _categoryService = abp.services.app.category; _$categoriesTable.jtable({ title: app.localize(‘CategoryManager‘),//标题 paging: true,//启用分页 sorting: true,//启用排序 multiSorting: true,//启用多列排序 actions: { listAction: { method: _categoryService.getCategories//获取列表方法 } }, fields: { id: { key: true, list: false }, actions: { title: app.localize(‘Actions‘),//操作列 width: ‘15%‘, sorting: false }, name: { title: app.localize(‘Name‘), width: ‘20%‘ } } }); //获取列表 function getCategories(reload) { if (reload) { _$categoriesTable.jtable(‘reload‘); } else { _$categoriesTable.jtable(‘load‘); } } //页面加载完执行 getCategories(); }); })();
ASP.NET Zero--9.一个例子(2)商品分类管理-列表
标签:asp dynamic 新建 alt 应用 tar pos public 标题
原文地址:http://www.cnblogs.com/shensigzs/p/6286743.html