Esempio n. 1
0
        /// <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));
        }
Esempio n. 2
0
        }// 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));
        }
Esempio n. 3
0
        // Admin Index

        public IActionResult CatalogList(int?page)
        {
            var model = new CatalogListModel()
            {
                Categories = uow.Categories.GetAll().ToList(),
                Products   = uow.Product.GetAll().ToList()
            };

            return(View(model));
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        /// <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));
        }
Esempio n. 6
0
 // 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;
 }
Esempio n. 7
0
        // 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);
        }
Esempio n. 8
0
        /// <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));
        }
Esempio n. 9
0
        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));
        }
Esempio n. 10
0
        /// <summary>
        /// 首页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            var model = new CatalogListModel();

            return(View("~/Views/Catalog/index.cshtml", model));
        }