/// <summary> /// 得到类目 /// </summary> /// <returns></returns> protected virtual IList <CatalogEntity> GetCatalogs(CatalogListModel model) { var query = new QueryInfo(); query.SetPageSize(model.PageSize).SetPageIndex(model.PageIndex).Query <CatalogEntity>().Where(it => it.Site.Id == SiteId) .OrderBy(it => it.Sequence).Select(it => new object[] { it.Id, it.Name, it.FileName, it.Sequence }); return(this.GetEntities <CatalogEntity>(query)); }
}// ajaxı tanımladıktan sonr bu beni iki tane action metodu tanımlamaktan kurtardı. Bu metot async değil.senkron metot. Bu ifade bana ne gibi bir çıkarım verir: ajax yalnızca senkron bir actionda çalışır. public IActionResult CatalogList() { var model = new CatalogListModel() { Categories = unitofWork.Categories.GetAll().ToList(), Products = unitofWork.Products.GetAll().ToList() }; return(View(model)); }
// Admin Index public IActionResult CatalogList(int?page) { var model = new CatalogListModel() { Categories = uow.Categories.GetAll().ToList(), Products = uow.Product.GetAll().ToList() }; return(View(model)); }
public IActionResult CatalogList() { var model = new CatalogListModel() { Categories = unitOfWork.Categories.GetAll().ToList(), Products = unitOfWork.Products.GetAll().ToList(), }; ViewBag.SuccessSave = TempData["SuccessSave"] ?? null; return(View(model)); }
/// <summary> /// 得到类目 /// </summary> /// <returns></returns> protected virtual IList <CatalogEntity> GetCatalogs(CatalogListModel model) { var query = new QueryInfo(); query.Query <CatalogEntity>().Where(it => it.Site.Id == SiteId) .OrderBy(it => it.Sequence).Select(it => new object[] { it.Id, it.Name, it.FileName, it.Commodities.Take(1). Where(s => s.Status == CommodityStatusType.Normal). OrderBy(s => s.Sequence).Select(s => new object[] { s.Id, s.Password, s.FileName }) }); return(this.GetEntities <CatalogEntity>(query)); }
// GET api/<controller> public CatalogListModel<PackageFeeEduInfo> Get(int page, int rows) { int totalRecords; var model = new CatalogListModel<PackageFeeEduInfo> { Page = page, Records = rows, Rows = CatalogRepository.Search<PackageFeeEduInfo>(string.Empty, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, }; return model; }
// GET api/<controller> public CatalogListModel <PackageInfo> Get(int page, int rows) { int totalRecords; var model = new CatalogListModel <PackageInfo> { Page = page, Records = rows, Rows = CatalogRepository.Search <PackageInfo>(string.Empty, page, rows, out totalRecords), Total = (totalRecords / rows) + 1, }; return(model); }
/// <summary> /// 首页 /// </summary> /// <returns></returns> public ActionResult List(int?page) { var model = new CatalogListModel { PageIndex = page.HasValue ? page.Value : 0 }; model.Catalogs = GetCatalogs(model); if (model.Catalogs == null || model.Catalogs.Count == 0) { return(Content("")); } return(View(GetViewPath("~/Views/Catalog/_Catalog.cshtml"), model)); }
public ActionResult All() { var model = new CatalogListModel(); var parentsCatalogs = _categoryService.GetAllCategories(parentId: 0); model.SubListCatalog = parentsCatalogs.Items.Select(p => new CatalogModel { Childs = _categoryService.GetCategoriesByParentId(p.Id).MapTo <List <CatalogModel> >(), Id = p.Id, Description = p.Description, MetaDescription = p.MetaDescription, MetaKeywords = p.MetaKeywords, MetaTitle = p.MetaTitle, Name = p.Name }).ToList(); return(View(model)); }
/// <summary> /// 首页 /// </summary> /// <returns></returns> public ActionResult Index() { var model = new CatalogListModel(); return(View("~/Views/Catalog/index.cshtml", model)); }